Confusion matrix
A table that counts a classifier’s right and wrong decisions by type: true and false positives, true and false negatives.

A confusion matrix is a table that counts a classifier’s right and wrong decisions by type. For a yes-or-no task it has four cells. True positive: flagged, and should be. False positive: flagged, but should not be, a false alarm. False negative: missed. True negative: correctly left alone.
Precision, recall and accuracy are all computed from these four counts, which is why the table tells you more than any single metric. Accuracy alone misleads on rare events: a model that never flags fraud is 99% accurate when 1% of transactions are fraud. For tasks with more than two classes the table grows to one row and one column per class, and the cells off the diagonal show which classes get mixed up, for example invoices filed as receipts. The counts depend on the decision threshold, so a vendor’s matrix holds only at the threshold they used.
Use it when you need to put money on errors: multiply the false positives by the cost of a false alarm and the false negatives by the cost of a miss. Building it needs labeled ground truth. The F1 score compresses it into one number and loses the detail of which error dominates.
Related terms
- Precision (AI metric): The share of returned results that are actually correct: of everything the system flagged or retrieved, how much was right.
- Recall (AI metric): The share of all correct items that the system actually found: of everything it should have caught, how much it did.
- F1 score: One number that combines precision and recall as their harmonic mean, so it is high only when both are high.
- Ground truth: The known correct answers or labels that a model’s output is compared against in an evaluation.
- Evals: A repeatable test set that scores an AI feature, so changes can be measured instead of guessed.
