How to Read a Binary Confusion Matrix

Title card for reading actual and predicted labels in a binary confusion matrix.

Start with the axis labels and choose which class counts as positive. A false positive is a document the model predicted as positive when its actual label was negative. A false negative is an actual positive the model missed. Find those two cells by reading their labels.

Read a review queue example

Imagine a classifier that sends some documents to a review queue. The actual labels come from a human check in this example. Set Needs review as positive and File as negative.

Actual label Predicted Needs review Predicted File
Needs review 6 4
File 3 17

The model correctly sent six documents to review and correctly filed seventeen. It missed four documents that needed review. Those are false negatives. It sent three documents to review that could have been filed. Those are false positives. The table uses the actual-row convention in scikit-learn’s confusion matrix reference. Scikit-learn orders classes by their sorted labels by default. With File coded as 0 and Needs review as 1, its output is [[17, 3], [4, 6]]. Use labels=[1, 0] to get the class order shown above.

Read the same counts with the axes swapped

Another course handout might put predicted labels on the rows. Here is the same result in that arrangement.

Predicted label Actual Needs review Actual File
Needs review 6 3
File 4 17

Look in the Predicted File row and the Actual Needs review column to find the same four missed documents. If you go to the top-right cell out of habit, you’ll find 3. That cell counts documents the model sent to review that could have been filed.

Check what positive means

Positive names the class you are tracking. In this example you chose Needs review because the task asks about missed review documents. If you choose File as positive instead, the same counts give 17 true positives, 6 true negatives, 4 false positives, and 3 false negatives. For instance, the model predicted File for four documents that actually needed review, so those become false positives for File.

Translate one cell in your own table

Pick one off-diagonal cell in a confusion matrix from class. Write what the document actually was, what the model predicted, and which type of error that makes it.

🚀 Join our affiliate program and earn 25% referral commission! 🚀 Earn 25% referral commission!