confusion

confusion(act,pred,pos) returns the confusion matrix determined by the column vectors of same length act and pred. Pos determines which variable is considered to be the positive one.
  • [conf mp] = confusion(act,pred,pos) with conf as a confusion matrix and mp as a vector containing the accurancy, precision, F1score, TPR and FPR of the model performance.

Example

>> act = {'T';'F';'T';'T';'T';'F'}      

% actual classes

pred = {'T';'F';'T';'T';'T';'T'}

% predicted classes

[conf mp] = confusion(act,pred,'T') [act:6x1 cell] [pred:6x1 cell] [conf:2x2 double] [mp:1x2 double] >> conf# 4 0 1 1 >> mp# 0.833333 0.8

See also

plotconfusion