FUNCTION REFERENCE
fitcensemble
Fit an ensemble of classification trees.
Fit an ensemble of classification trees.
Syntax
mdl = fitcensemble(X,Y,'Method','Bag','NumLearningCycles',100,'Learners','tree','LearnRate',1)Methods are Bag, AdaBoostM1 (binary), AdaBoostM2 (multiclass), GentleBoost (binary), LogitBoost (binary) and RUSBoost. This build defaults to Bag for multiclass data and LogitBoost for binary data. Bag bootstraps all predictors; boosting defaults to stumps. templateTree configures MaxNumSplits and MinLeafSize. TrainedWeights exposes learner weights. predict returns labels and ensemble scores; loss/resubLoss/margin/edge and predictorImportance are available. oobLoss evaluates Bag rows excluded from bootstrap samples. rng controls bagging and undersampling.
Example
rng(2); m=fitcensemble([0;1;4;5],[1;1;2;2],'NumLearningCycles',8); [y,s]=predict(m,[0;5])Differences from MATLAB: Bag uses all predictors, without random feature selection; the default differs from MATLAB. At most 1000 cycles, 50000000 split-search units, and 128 MiB retained trees are supported. LearnRate is in (0,1]; sampling options and pruning are unsupported.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.