In classification problems, a confusion matrix is a matrix whose columns are predicted classifications and whose rows are actual classifications. The values in each element represent the count (or proportion) of examples with the specified combination of predicted and actual classifications. A perfect classifier would thus be a diagonal matrix.

In binary classification, the confusion matrix reduces to