FUNCTION REFERENCE

fitrensemble

Fit least-squares boosted trees or bootstrap-aggregated regression trees.

Fit least-squares boosted trees or bootstrap-aggregated regression trees.

Syntax

mdl = fitrensemble(X,Y)

Syntax

mdl = fitrensemble(tbl,'response~a+b'); mdl = fitrensemble(tbl,'ResponseVarName')

Syntax

mdl = fitrensemble(X,Y,'Method','LSBoost','NumLearningCycles',100,'LearnRate',1,'Learners',templateTree('MaxNumSplits',1))

Method is LSBoost (default) or Bag. LSBoost starts at mean(Y) and fits residual trees; LearnRate is in (0,1]. Default trees use MinLeafSize=5, MinParentSize=10, and ten splits for boosting or unrestricted splits for Bag. Bag samples n rows with replacement per tree from the session rng stream and averages predictions. NumTrained and Method describe the ensemble; predictorImportance averages tree importance.

Example

rng(4); t=templateTree('MaxNumSplits',1,'MinLeafSize',1,'MinParentSize',2); m=fitrensemble((0:7)',[0;0;1;1;4;4;5;5],'Learners',t,'NumLearningCycles',3); predict(m,[1;6])

Differences from MATLAB: only numeric tree learners, no random predictor subspaces or observation weights. NumLearningCycles is capped at 1000 and cycles times predictor elements at 20000000. Bag stores in-bag membership for oobLoss.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.