'naivebayes' learner option fails when optimizing hyper-parameters for 'fitcecoc' function.
Show older comments
I am attempting to optimize a multi-class classifier. The classifier uses a (187 x 20) predictor matrix and a (187 x 1) categorical label vector (6 possible categories labeld 1 through 6). I am trying to run the optimization as follows:
Mdl = fitcecoc(predictorMat, labelVec, 'Learners', 'naivebayes', 'OptimizeHyperparameters','all',...
'HyperparameterOptimizationOptions',struct('AcquisitionFunctionName',...
'expected-improvement-plus', 'MaxObjectiveEvaluations', 10, 'UseParallel', ...
true, 'Kfold', 5));
This returns the following error:
Error using classreg.learning.paramoptim.BayesoptInfoCECOC/templateFromLearnersArg (line 127)
Optimizing hyperparameters for fitcecoc with learner type 'naivebayes' is not supported.
Error in classreg.learning.paramoptim.BayesoptInfoCECOC/getWeakLearnerTemplate (line 63)
Template = templateFromLearnersArg(this, LearnersArg);
Error in classreg.learning.paramoptim.BayesoptInfoCECOC (line 29)
this.WeakLearnerTemplate = getWeakLearnerTemplate(this, FitFunctionArgs);
Error in classreg.learning.paramoptim.BayesoptInfo.makeBayesoptInfo (line 127)
Obj = ConstructorFcn(Predictors, Response, FitFunctionArgs);
Error in classreg.learning.paramoptim.fitoptimizing (line 17)
BOInfo = classreg.learning.paramoptim.BayesoptInfo.makeBayesoptInfo(FitFunctionName, Predictors, Response, FitFunctionArgs);
Error in fitcecoc (line 283)
[obj, OptimResults] = classreg.learning.paramoptim.fitoptimizing('fitcecoc',X,Y,varargin{:});
This is odd since the expected hyper-parameter optimization behavior of 'fitceoc' with 'naivebayes' learners is described in the function's docs (see the Hyperparameter Optimization section about 3/4 of the way down that doc: https://www.mathworks.com/help/stats/fitcecoc.html). Moreover, in the code above changing the leaerner to 'svm' (or any of the other learner types such as 'knn' or 'kernel') goes through the optimization as expected. I am trying this on Matlab 2021a. Thanks for any help.
Accepted Answer
More Answers (0)
Categories
Find more on Classification Ensembles in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!