www.gusucode.com > stats 源码程序 matlab案例代码 > stats/ObtainEnsembleHyperparametersExample.m
%% Obtain Ensemble Hyperparameters % Obtain the default hyperparameters for the |fitrensemble| ensemble % regression function. %% % Load the |carsmall| data. load carsmall %% % Use |Horsepower| and |Weight| as predictor variables, and |MPG| as the % response variable. X = [Horsepower Weight]; Y = MPG; %% % Obtain the default hyperparameters for a |Tree| learner. VariableDescriptions = hyperparameters('fitrensemble',X,Y,'Tree'); %% % Examine all the hyperparameters. for ii = 1:length(VariableDescriptions) disp(ii),disp(VariableDescriptions(ii)) end %% % Change the |MaxNumSplits| hyperparameter to have a wider range and to be % used in an optimization. VariableDescriptions(5).Range = [1,200]; VariableDescriptions(5).Optimize = true; disp(VariableDescriptions(5))