Main Content

Classification Trees

Binary decision trees for multiclass learning

To interactively grow a classification tree, use the Classification Learner app. For greater flexibility, grow a classification tree using fitctree at the command line. After growing a classification tree, predict labels by passing the tree and new predictor data to predict.


Classification LearnerTrain models to classify data using supervised machine learning


ClassificationTree PredictClassify observations using decision tree classifier (Since R2021a)


expand all

fitctreeFit binary decision tree for multiclass classification
compactCompact tree
pruneProduce sequence of classification subtrees by pruning
cvlossClassification error by cross validation
limeLocal interpretable model-agnostic explanations (LIME) (Since R2020b)
nodeVariableRangeRetrieve variable range of decision tree node (Since R2020a)
partialDependenceCompute partial dependence (Since R2020b)
plotPartialDependenceCreate partial dependence plot (PDP) and individual conditional expectation (ICE) plots
predictorImportanceEstimates of predictor importance for classification tree
shapleyShapley values (Since R2021a)
surrogateAssociationMean predictive measure of association for surrogate splits in classification tree
viewView classification tree
crossvalCross-validated decision tree
kfoldEdgeClassification edge for cross-validated classification model
kfoldLossClassification loss for cross-validated classification model
kfoldMarginClassification margins for cross-validated classification model
kfoldPredictClassify observations in cross-validated classification model
kfoldfunCross-validate function for classification
lossClassification error
resubLossClassification error by resubstitution
compareHoldoutCompare accuracies of two classification models using new data
edgeClassification edge
marginClassification margins
resubEdgeClassification edge by resubstitution
resubMarginClassification margins by resubstitution
testckfoldCompare accuracies of two classification models by repeated cross-validation
predictPredict labels using classification tree
resubPredictPredict resubstitution labels of classification tree
gatherGather properties of Statistics and Machine Learning Toolbox object from GPU (Since R2020b)


ClassificationTreeBinary decision tree for multiclass classification
CompactClassificationTreeCompact classification tree
ClassificationPartitionedModelCross-validated classification model