Main Content

Predict labels using classification tree

uses
additional options specified by one or more `label`

= predict(`Mdl`

,`X`

,`Name,Value`

)`Name,Value`

pair
arguments. For example, you can specify to prune `Mdl`

to
a particular level before predicting labels.

`[`

uses any of the input argument
in the previous syntaxes and additionally returns:`label`

,`score`

,`node`

,`cnum`

]
= predict(___)

A matrix of classification scores (

`score`

) indicating the likelihood that a label comes from a particular class. For classification trees, scores are posterior probabilities. For each observation in`X`

, the predicted class label corresponds to the minimum expected misclassification cost among all classes.A vector of predicted node numbers for the classification (

`node`

).A vector of predicted class number for the classification (

`cnum`

).

`predict`

generates predictions by following
the branches of `Mdl`

until it reaches a leaf node
or a missing value. If `predict`

reaches a leaf node,
it returns the classification of that node.

If `predict`

reaches a node with a missing value
for a predictor, its behavior depends on the setting of the `Surrogate`

name-value
pair when `fitctree`

constructs `Mdl`

.

(default) —`Surrogate`

=`'off'`

`predict`

returns the label with the largest number of training samples that reach the node.—`Surrogate`

=`'on'`

`predict`

uses the best surrogate split at the node. If all surrogate split variables with positive*predictive measure of association*are missing,`predict`

returns the label with the largest number of training samples that reach the node. For a definition, see Predictive Measure of Association.

`ClassificationTree`

| `compact`

| `CompactClassificationTree`

| `edge`

| `fitctree`

| `loss`

| `margin`

| `prune`