Glossary
Confusion matrix
A table comparing a classifier's predicted labels against actual labels, breaking results into true and false positives and negatives.
Also called: error matrix
A confusion matrix is a table that cross-tabulates a classification model's predicted labels against the actual, correct labels. For a binary outcome, it has four cells: true positives, predicted positive and actually positive; true negatives, predicted negative and actually negative; false positives, predicted positive but actually negative; and false negatives, predicted negative but actually positive.
Every standard classification metric is calculated from these four counts. precision and recall and the f1 score are both derived directly from the matrix at one chosen decision threshold, while ROC AUC summarizes how the matrix would look across every possible threshold. Viewing the raw matrix, rather than only a summary metric, shows exactly which kind of mistake a model is making, which matters because false positives and false negatives usually carry very different real-world costs.
Confusion matrices extend naturally to more than two classes, becoming an n x n grid where the diagonal holds correct predictions and off-diagonal cells show which classes are commonly confused with each other. A common pitfall is judging a model only by overall accuracy, the sum of the diagonal divided by the total, which can look excellent on an imbalanced dataset even when the model never correctly identifies the rare class of real interest.
Last reviewed September 22, 2026