This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Train Classification Ensemble

This example shows how to create a classification tree ensemble for the ionosphere data set, and use it to predict the classification of a radar return with average measurements.

Load the ionosphere data set.

load ionosphere

Train a classification ensemble. For binary classification problems, fitcensemble aggregates 100 classification trees using LogitBoost.

Mdl = fitcensemble(X,Y)
Mdl = 
  classreg.learning.classif.ClassificationEnsemble
             ResponseName: 'Y'
    CategoricalPredictors: []
               ClassNames: {'b'  'g'}
           ScoreTransform: 'none'
          NumObservations: 351
               NumTrained: 100
                   Method: 'LogitBoost'
             LearnerNames: {'Tree'}
     ReasonForTermination: 'Terminated normally after completing the requested number of training cycles.'
                  FitInfo: [100x1 double]
       FitInfoDescription: {2x1 cell}


  Properties, Methods

Mdl is a ClassificationEnsemble model.

Plot a graph of the first trained classification tree in the ensemble.

view(Mdl.Trained{1}.CompactRegressionLearner,'Mode','graph');

By default, fitcensemble grows shallow trees for boosting algorithms. You can alter the tree depth by passing a tree template object to fitcensemble. For more details, see templateTree.

Predict the quality of a radar return with average predictor measurements.

label = predict(Mdl,mean(X))
label = 1x1 cell array
    {'g'}

See Also

|

Related Topics