Warning: This documentation is for scikits.learn version 0.7.1. — Latest stable version

Contents

6.9.2. scikits.learn.metrics.confusion_matrix

scikits.learn.metrics.confusion_matrix(y_true, y_pred, labels=None)

Compute confusion matrix to evaluate the accuracy of a classification

By definition a confusion matrix cm is such that cm[i, j] is equal to the number of observations known to be in group i but predicted to be in group j

Parameters :

y_true : array, shape = [n_samples]

true targets

y_pred : array, shape = [n_samples]

estimated targets

Returns :

CM : array, shape = [n_classes, n_classes]

confusion matrix

References

http://en.wikipedia.org/wiki/Confusion_matrix