Back to Classic ML Mind Map
中文·English
📊 Classic MLID: precision-recall-f1

Precision, Recall & F1

Precision/Recall/F1
🎯Core Definition
three core classification metrics derived from the confusion matrix. Precision P=TPTP+FPP = \frac{TP}{TP + FP} (of the samples predicted positive, how many are truly positive — “quality over quantity”); Recall R=TPTP+FNR = \frac{TP}{TP + FN} (of the truly positive samples, how many were found — “better safe than sorry”); F1=2PRP+RF1 = \frac{2PR}{P + R} is their harmonic mean, summarizing both in one number; more generally Fβ=(1+β2)PRβ2P+RF_\beta = \frac{(1+\beta^2)PR}{\beta^2 P + R}, where β>1\beta > 1 weights recall more (e.g. F2F_2) and β<1\beta < 1 weights precision more. The harmonic mean punishes imbalance: P=1,R=0.1P = 1, R = 0.1 gives F10.18F1 \approx 0.18, far below the arithmetic mean of 0.55.
💡Use Cases
almost guaranteed in interviews around imbalanced data and funnel-style products (search, recsys, risk control); the PR curve traces P vs R as the threshold moves, and the random-classifier baseline is P=ρP = \rho where ρ=TP+FNN\rho = \frac{TP+FN}{N} is the positive rate (e.g. baseline P=0.01P = 0.01 at a 1% positive rate); be ready for “why F1 instead of accuracy” and “PR curve vs ROC curve”.
Key Problems Solved
decouples evaluation from the majority class — P looks only at the predicted-positive column and R only at the truly-positive row, neither diluted by the huge negative population; the harmonic mean exposes models with one high and one low score (always predicting positive yields P=ρ0P = \rho \approx 0), which the arithmetic mean would hide. Fβ tunes the trade-off by business cost: screening with fatal misses uses β=2\beta = 2 to favor recall, ad placement wasting budget uses β=0.5\beta = 0.5 to favor precision.
🎯5 High-Frequency Exam Points
1
Hand computation: a model has P=0.9,R=0.5P = 0.9, R = 0.5; compute F1 and explain why it is below the arithmetic mean.
2
Why does F1 use the harmonic mean instead of the arithmetic mean? What is F1 when P=1,R=0.1P = 1, R = 0.1?
3
Meaning of β in FβF_\beta: what do F2F_2 and F0.5F_{0.5} emphasize, and which fits medical screening vs ad placement?
4
When to choose the PR curve over ROC: why is PR more sensitive to class imbalance, and what does the baseline P=ρP = \rho mean?
5
How to derive the PR curve from model scores, and how to pick the operating threshold (F1 maximization / cost minimization)?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Precision, Recall & F1"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardConfusion MatrixNext CardROC-AUC

🔗 More Classic ML Knowledge Cards

AdaBoost DerivationBagging & Random ForestBaum-Welch (HMM EM)GBDT Negative Gradient