confusionmatrix

Computes confusion matrix for classifier's predictions. The row represents the actual label and the column represents the predicted label. Each cell represents how many examples are actually actual label but predicted as predicted label, where the best value: except left to right diagonal, all are zero, and worst value: left to right diagonal are zero.

Attention: Available only with Activate commercial edition.

Syntax

[cmatrix, Labels] = confusionmatrix(targets,predictions)

Inputs

targets
Actual label for each observation.
Type: double
Dimension: vector
predictions
Predicted value for each observation.
Type: double
Dimension: vector

Outputs

cmatrix
Confusion matrix of the predictions.
Type: integer
Dimension: matrix
Labels
Unique labels, which are in the same row and column order.
Type: integer
Dimension: vector

Example

Usage of confusionmatrix

targets = [1, 0, 1, 0, 2];
predictions = [1, 1, 0, 0, 2];
[cm, labels] = confusionmatrix(targets, predictions);
> score1
score1 = 0.5