Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Create confusion matrix chart for classification problem

`cm = confusionchart(trueLabels,predictedLabels)`

`cm = confusionchart(m)`

`cm = confusionchart(m,classLabels)`

`cm = confusionchart(parent,___)`

`cm = confusionchart(___,Name,Value)`

creates a confusion matrix chart from true labels `cm`

= confusionchart(`trueLabels`

,`predictedLabels`

)`trueLabels`

and
predicted labels `predictedLabels`

and returns a
`ConfusionMatrixChart`

object. The rows of the confusion matrix
correspond to the true class and the columns correspond to the predicted class. Diagonal
and off-diagonal cells correspond to correctly and incorrectly classified observations,
respectively. Use `cm`

to modify the confusion matrix chart after it is
created. For a list of properties, see ConfusionMatrixChart Properties.

creates a confusion matrix chart from the numeric confusion matrix `cm`

= confusionchart(`m`

)`m`

.
Use this syntax if you already have a numeric confusion matrix in the workspace.

specifies class labels that appear along the `cm`

= confusionchart(`m`

,`classLabels`

)*x*-axis and
*y*-axis. Use this syntax if you already have a numeric
confusion matrix and class labels in the workspace.

creates the confusion chart in the figure, panel, or tab specified by
`cm`

= confusionchart(`parent`

,___)`parent`

.

specifies additional `cm`

= confusionchart(___,`Name,Value`

)`ConfusionMatrixChart`

properties using one or
more name-value pair arguments. Specify the properties after all other input arguments.
For a list of properties, see ConfusionMatrixChart Properties.