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

9 次查看(过去 30 天)
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 个评论
Alan Weiss
Alan Weiss 2020-11-15
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

请先登录,再进行评论。

回答(1 个)

Alan Weiss
Alan Weiss 2020-11-17
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

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by