Confusion Matrix

A table that shows how often a classifier makes each kind of right and wrong prediction.

Which damaged pieces did the sorter miss?

Imagine 40 ceramics inspected by both a model and a conservator. The conservator’s assessment supplies the reference labels. Rows below are actual conditions and columns are model decisions. “Chipped” is the positive class.

Actual conditionFlagged chippedCalled intact
Chipped82
Intact327

How do you read the four cells?

Eight chipped pieces were correctly flagged and two were missed. Three intact pieces drew false alarms and 27 were correctly cleared. Reading down the flagged column answers a different question from reading across the chipped row.

A compartmented tray holds intact and broken ceramic samples.
A reference inspection gives the row. The model’s decision determines the column.

Which denominator answers your question?

Of 11 flagged pieces, eight were chipped, so precision is 8/11, about 73%. Of ten truly chipped pieces, eight were found, so recall is 8/10, or 80%. Overall accuracy is 35/40, or 87.5%. Keep the counts with the percentages so the reader can recover each denominator.

Follow the idea

Precision · Inspect the cases entering the review queue.

Recall · Count the actual positives that were found.

Source · Scikit-learn confusion matrix documentation

Return to Confusion Matrix in the A–Z glossary