All courses › Machine Learning and Data Analysis › Precision and recall

Precision and recall

Precision answers how often the model is right when it says yes. Recall answers how many of the real cases it found. F1 is a compromise between them. Which matters most depends on what costs more: false alarms or missed cases.

P=TPTP+FPP = \frac{TP}{TP + FP}precision
R=TPTP+FNR = \frac{TP}{TP + FN}recall
F1=2PRP+RF_1 = \frac{2PR}{P + R}F1 score

Symbols

PPprecision
RRrecall
F1F_1harmonic mean of P and R

Example

TP = 40, FP = 10, FN = 20:

P=0.8P = 0.8, R≈0.67R \approx 0.67 and F1≈0.73F_1 \approx 0.73.

In cancer screening recall matters most, in a spam filter precision matters most.
Practise classification and evaluation for free →

← The confusion matrix · Sigmoid and threshold →

Part of Machine Learning and Data Analysis: Classification and evaluation.