<< nan_classify Classification nan_fss >>

NaN Toolbox >> NaN Toolbox > Classification > nan_confusionmat

nan_confusionmat

Confusion matrix for visualization of the performance of an algorithm

Calling Sequence

CM = nan_confusionmat(G,GHAT)
CM = nan_confusionmat(G,GHAT,ORDER)
[CM, GORDER] = nan_confusionmat(G, GHAT)

Parameters

G:

actual group labels

GHAT:

predicted group labels

CM :

confusion matrix

ORDER:

(vector) species the order of rows (and columns) of the confusion matrix

GORDER:

order of group labels for rows and columns of CM.

Description

The confusion matrix CM(I,J) represents the count of instances whose actual group labels are group I and whose predicted group labels are group J.

predicted Classes

___|_____|______|

actual ' | | |

Classes | | |

If the number of classes is two then the first class is the positive class and the second class is the negative class

CM(1,1) is the number of true positive instances

CM(2,1) is the number of false negative instances

CM(1,2) is the number of false positive instances

CM(2,2) is the number of true negative instances

nan_confusionmat treats NaNs, empty strings or 'undefined' values in G or GHAT as missing values, and removes those entries

Examples

actual=   [0 0 1 1 0 0 0]
predicted=[0 1 0 1 0 0 1]
// now we have 3 true positive (0 were classified as 0)
// 2 false negatives (0 were incorrectly marked as 1)
// 1 false positive (1 were incorrectly marked as 0)
// 1 true negatives (1 were correctly classified as 1)
[cm,order] = nan_confusionmat(actual,predicted)

See also


Report an issue
<< nan_classify Classification nan_fss >>