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 Twin Activate commercial edition.
Syntax
[cmatrix, Labels] = confusionmatrix(targets,predictions)
Inputs
- targets
- Actual label for each observation.
- predictions
- Predicted value for each observation.
Outputs
- cmatrix
- Confusion matrix of the predictions.
- Labels
- Unique labels, which are in the same row and column order.
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