How to optimize hyperparameters for fitcensemble using a customized maximize function?

11 views (last 30 days)
Hi, I have been using fitcensemble method to minimize objective function by default, as I can get the minimum objective result from mdl, which is a ClassificationEnsemble
mdl = fitcensemble(XTrain,yTrain,...
'OptimizeHyperparameters',auto,...
'Learners',template, ...
'HyperparameterOptimizationOptions',hyperoptsOptions,...
'ScoreTransform','logit',...
'CategoricalPredictors', isCategoricalPredictor,...
'PredictorNames', predictorNames);
minObj = mdl.HyperparameterOptimizationResults.MinObjective;
Is it possible to get a customized maximize function from fitcensemble function?. If yes, could you provide me an example please?
Thank you
  2 Comments
Alan Weiss
Alan Weiss on 15 Nov 2020
I do not understand what you are trying to do. fitcensemble tries to fit a classification ensemble by minimizing an error. What sense would it make to maximize an error?
Alan Weiss
MATLAB mathematical toolbox documentation
Yean Lim
Yean Lim on 15 Nov 2020
Hi I want to maximize a customised accuracy definition from the model given by the fitcensemble

Sign in to comment.

Answers (1)

Alan Weiss
Alan Weiss on 17 Nov 2020
I am not sure, but maybe you can use the fitcensemble 'Cost' name-value argument. Give the negative of your customized accuracy measure in order that fitcensemble will look for a maximum. Or maybe give a constant minus the customized accuracy where you choose the constant so that the cost will always be positive, but not too large so that the differences still matter.
Alan Weiss
MATLAB mathematical toolbox documentation

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!