What is a confusion matrix and what can you compute from it?
A confusion matrix is a table that summarizes classification results by comparing predicted versus actual labels. For binary classification it has four cells: true positives (TP), true negatives (TN), false positives (FP, type I error), and false negatives (FN, type II error). From these you derive key metrics: accuracy = (TP+TN)/total; precision = TP/(TP+FP), how many predicted positives are correct; recall/sensitivity = TP/(TP+FN), how many actual positives were caught; specificity = TN/(TN+FP); and F1 = harmonic mean of precision and recall. It reveals what kind of errors a model makes, not just overall accuracy, which is essential for imbalanced problems where accuracy can be misleadingly high. It extends to multi-class as an NxN grid.