Confusion matrix
A confusion matrix tabulates predicted labels against observed labels for a specified set of classification decisions.
Axis labels matter: scikit-learn places observed classes in rows and predictions in columns, while Fawcett's Figure 1 uses the transposed convention. With rows = observed, columns = predicted and class order [0, 1], the binary matrix is [[TN, FP], [FN, TP]], where 1 is the positive class. [1] [2]
Keep raw counts alongside normalized values. Row normalization conditions on the observed class, column normalization on the predicted class, and whole-matrix normalization on all included observations. A 2-by-2 array without its class order and axis convention is ambiguous. [1]
For drive prediction, specify the failure label, prediction horizon, threshold and observation unit. A matrix of daily decisions is not a count of distinct drives or replacement actions. Unresolved outcomes must not silently become healthy labels; retain the exclusion and follow-up rules. This is an application of the counting definition, not a performance claim. [2]
In a synthetic 10,000-decision example, [[9801, 99], [10, 90]] yields 90 true alerts, 99 false alerts and 10 missed positives. The negative-class denominator is 9900; the alert denominator is 189. [3]
Relations
- related
- Specificity, Balanced accuracy, Precision, Recall, False positive rate, Prediction horizon, Prediction cadence
Citations
- scikit-learn: confusion_matrix; axis conventions, label order and normalization.
- Fawcett (2006). An introduction to ROC analysis, section 2 and Figure 1. DOI: 10.1016/j.patrec.2005.10.010.
- Hesela: synthetic classification counts, exact fractions and edge-case checks.
Sources & caveats
- Reviewed 2026-11-22: Fawcett section 2 and Figure 1, plus the confusion_matrix API documentation.
- Storage-specific reporting guidance is Hesela's application of the counting definition. Worked counts are synthetic, with exact rational checks.