A confusion matrix is a table that shows how a classification model performed by counting its true positives, false positives, true negatives and false negatives.
For a yes-or-no model, the matrix has four cells. True positives are cases the model flagged correctly, false positives are cases it flagged wrongly, false negatives are real cases it missed, and true negatives are cases it correctly left alone. Say a spam filter checks 1,000 emails: it catches 90 of 100 spam emails (90 true positives, 10 false negatives) and wrongly flags 20 of 900 genuine ones (20 false positives, 880 true negatives).
Accuracy alone would say 97 percent, which hides the 10 spam emails that got through and the 20 real ones sent to junk. The matrix shows which mistake the model makes, and the cells feed the standard metrics: precision and recall come straight from them, as Google explains in its machine learning course.
For a business, the useful question is which error costs more. A missed fraud case and a wrongly blocked customer have very different costs, so read the matrix with those costs in mind when you evaluate a model.
Saraswati Stitch®