Enter your TP, FP, TN, FN values to instantly compute precision, recall, F1 score, accuracy, and more.
A confusion matrix summarizes how well a binary classification model performs by breaking predictions into four categories. True Positive (TP): the model correctly predicted positive. False Positive (FP): the model incorrectly predicted positive (a "false alarm"). False Negative (FN): the model incorrectly predicted negative (a "miss"). True Negative (TN): the model correctly predicted negative. Every classification metric, accuracy, precision, recall, F1, is derived from these four numbers.
Accuracy, the percentage of all predictions that were correct, is the most intuitive metric but often the most misleading one, especially on imbalanced datasets. Consider a fraud detection model on data where only 1% of transactions are actually fraudulent, a model that simply predicts "not fraud" for every single transaction achieves 99% accuracy while being completely useless, it never catches actual fraud. This is exactly why precision, recall, and F1 exist, they reveal performance that accuracy alone hides.
Precision answers "of everything the model flagged as positive, how much was actually positive?", it matters when false positives are costly (flagging a legitimate email as spam, wrongly denying a loan). Recall answers "of everything that was actually positive, how much did the model catch?", it matters when false negatives are costly (missing a cancer diagnosis, failing to catch actual fraud). These two metrics are usually in tension, a model tuned to catch every possible positive case (high recall) will typically also flag more false positives (lower precision), and vice versa.
F1 Score is the harmonic mean of precision and recall, giving a single number that balances both, useful when you need one metric to compare models but care about both false positives and false negatives. Matthews Correlation Coefficient (MCC) is considered by many researchers to be a more reliable single-number summary than F1, especially on imbalanced data, since it accounts for all four confusion matrix values (including true negatives, which F1 ignores) and ranges from -1 (total disagreement) to +1 (perfect prediction), with 0 representing random guessing.