FUNCTION REFERENCE
fitctree
Fit a CART classification tree using Gini impurity.
Fit a CART classification tree using Gini impurity.
Syntax
mdl = fitctree(X,Y)Syntax
mdl = fitctree(tbl,'ResponseVarName')Syntax
mdl = fitctree(tbl,Y)Syntax
mdl = fitctree(X,Y,'MaxNumSplits',n,'MinLeafSize',m,'MinParentSize',p,'SplitCriterion','gdi')Defaults are MinLeafSize 1, MinParentSize 10, and at most NumObservations-1 splits. MaxNumSplits bounds the total splits, choosing the largest impurity reduction among pending leaves. Scores are class fractions at the reached leaf. NumNodes and Children expose tree structure; Children uses one-based node indices and zero for a leaf.
Example
mdl=fitctree([0;2],[1;2],'MinParentSize',2); [label,score]=predict(mdl,[0;2])Differences from MATLAB: only finite numeric predictors and Gini splits are supported; pruning, categorical predictors, surrogates and view are unsupported. The split search is bounded to 50000000 row-feature visits, in addition to common classifier training limits.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.