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
compactReduce size of classification tree model
pruneProduce sequence of classification subtrees by pruning classification tree
cvlossClassification error by cross-validation for classification tree model
limeLocal interpretable model-agnostic explanations (LIME) (Since R2020b)
nodeVariableRangeRetrieve variable range of decision tree node (Since R2020a)
partialDependenceCompute partial dependence (Since R2020b)
permutationImportancePredictor importance by permutation (Since R2024a)
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-validate machine learning model
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 loss for classification tree model
resubLossResubstitution classification loss for classification tree model
compareHoldoutCompare accuracies of two classification models using new data
edgeClassification edge for classification tree model
marginClassification margins for classification tree model
resubEdgeResubstitution classification edge for classification tree model
resubMarginResubstitution classification margins for classification tree model
testckfoldCompare accuracies of two classification models by repeated cross-validation
predictPredict labels using classification tree model
resubPredictClassify observations in classification tree by resubstitution
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