Precision, Recall and F1
Precision asks how many of the model's alarms were real; recall asks how many real cases it caught. F1 combines both.
Also precision · recall · F1 score · confusion matrix · true positive · false positive
A metal detector on a beach. Precision: of all the beeps, how many were real treasure (not bottle caps)? Recall: of all the treasure buried there, how much did it beep for?
Where it fits
+All relationships as a list
Is a kind of / part of
Siblings
Used by
How it works
Accuracy hides what kind of mistakes a classifier makes. The confusion matrix splits them out:
| Actually positive | Actually negative | |
|---|---|---|
| Predicted positive | True positive (TP) | False positive (FP) |
| Predicted negative | False negative (FN) | True negative (TN) |
From it:
- Precision = TP / (TP + FP): when the model says “yes”, how often is it right?
- Recall = TP / (TP + FN): of all the real “yes” cases, how many did it find?
- F1 = the harmonic mean of precision and recall, high only if both are.
Most classifiers output a score, and a threshold turns it into yes or no. Lower the threshold and you catch more real cases (recall up) but raise more false alarms (precision down). Which balance is right depends on costs: a cancer screen wants high recall, a spam filter high precision.
The ROC curve shows the whole trade-off by plotting true-positive rate against false-positive rate for every threshold; the area under it (ROC-AUC) summarizes ranking quality in one number.
Everyday use cases
- Case 01
Disease screening
High recall matters most; missing a sick patient is worse than a false alarm that a follow-up test clears.
- Case 02
Spam filtering
High precision matters; sending a real email to spam is costly.
Strengths, weaknesses and when to use it
Strengths
- Meaningful even when classes are very imbalanced, unlike accuracy.
Weaknesses
- Two numbers to balance; the right trade-off depends on real-world costs.
When to use itFor any classifier where the positive class is rare or errors have different costs.
Compare with
Check yourself
- Q01
A fraud model flags 100 transactions; 80 are real fraud. There were 200 frauds in total. What are precision and recall?
Show answer
A: Precision 80%, recall 40%
- Q02
What usually happens to recall if you lower the decision threshold?
Show answer
A: It goes up (more positives are caught)