Enter TP, FP, FN, and TN values to instantly compute all classification metrics.
| Predicted Positive | Predicted Negative | |
|---|---|---|
| Actual Positive | TP (True Positive) | FN (False Negative) |
| Actual Negative | FP (False Positive) | TN (True Negative) |
A confusion matrix is a table that summarizes the performance of a classification model by showing the counts of correct and incorrect predictions broken down by class. The four quadrants are: True Positive (TP) — model correctly predicts positive; True Negative (TN) — model correctly predicts negative; False Positive (FP) — model predicts positive but it is actually negative (Type I error); False Negative (FN) — model predicts negative but it is actually positive (Type II error).
Different metrics suit different problems: Precision matters for spam filters (you want few legitimate emails marked as spam). Recall matters for cancer screening (you want to miss as few real cases as possible). F1 Score is the harmonic mean of both and is the go-to metric for imbalanced datasets. MCC (Matthews Correlation Coefficient) is considered the most informative single metric for binary classification.
Accuracy is misleading when classes are imbalanced. A model that always predicts the majority class achieves 99% accuracy on a dataset where only 1% of samples are positive — yet it has zero predictive power. In such cases, use F1 Score or MCC, which account for both false positives and false negatives. MCC is particularly robust because it considers all four cells of the confusion matrix and returns a value between −1 and +1, where +1 is a perfect prediction.