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

    %% Train Boosted Classification Ensemble
%%
% Load the |ionosphere| data set.
load ionosphere
%%
% Train a boosted ensemble of 100 classification trees using all
% measurements and the |AdaBoostM1| method.
Mdl = fitensemble(X,Y,'AdaBoostM1',100,'tree')
%%
% |Mdl| is a |ClassificationEnsemble| model object.
%%
% |Mdl.Trained| is the property that stores a 100-by-1 cell vector
% of the trained classification trees (|CompactClassificationTree| model
% objects) that compose the ensemble.
%%
% Plot a graph of the first trained classification tree.
view(Mdl.Trained{1},'Mode','graph')
%%
% By default, |fitensemble| grows stumps for boosted ensembles of trees.
%%
% Predict the label of the mean of |X|.
predMeanX = predict(Mdl,mean(X))