www.gusucode.com > stats 源码程序 matlab案例代码 > stats/ViewTreeFromBoostedEnsembleExample.m

    %% View Tree from Boosted Ensemble
%%
% Load Fisher's iris data set.
load fisheriris
%%
% Boost an ensemble of 100 classification trees using all measurements.
Mdl = fitensemble(meas,species,'AdaBoostM2',100,'Tree');
%%
% |Mdl| is a <docid:stats_ug.bstzl0v-1 |ClassificationEnsemble|> model object.
% |Mdl.Trained| stores the ensemble of 100 trained classification trees in a
% 100-by-1 cell array.  That is, each cell in |Mdl.Trained| contains a
% |CompactClassificationTree| model object.
%%
% View a graph of the 10th classification tree in the ensemble.
Tree10 = Mdl.Trained{10};
view(Tree10,'Mode','graph');
%%
% By default, |fitensemble| grows shallow trees for boosted ensembles of
% trees.