www.gusucode.com > stats 源码程序 matlab案例代码 > stats/OptimizeAClassificationEnsembleExample.m
%% Optimize Classification Ensemble % This example shows how to optimize hyperparameters automatically using % |fitcensemble|. The example uses the |ionosphere| data. %% % Load the data. load ionosphere %% % Find hyperparameters that minimize five-fold cross-validation loss by % using automatic hyperparameter optimization. % % For reproducibility, set the random seed and use the % |'expected-improvement-plus'| acquisition function. rng default Mdl = fitcensemble(X,Y,'OptimizeHyperparameters','auto',... 'HyperparameterOptimizationOptions',struct('AcquisitionFunctionName',... 'expected-improvement-plus')) %% % The optimization searched over the methods for binary classification, % over |NumLearningCycles|, over the |LearnRate| for applicable methods, % and over the tree learner |MinLeafSize|. The output is the ensemble % classifier with the minimum estimated cross-validation loss.