F1 Score definition
The F1 score is the harmonic mean of classification precision and recall.
F1 Score in a picture
How it works
With precision P and recall R, calculate 2PR/(P + R) when those inputs are defined and their sum is positive. Equivalently use 2TP/(2TP + FP + FN) when its denominator is positive. This gives a lower score when either precision or recall is low.
Worked examples
Find F1 when precision and recall both equal 0.75.
F1 = 0.75.
For TP = 12, FP = 3, FN = 8, calculate F1.
24/(24 + 3 + 8) = 24/35 ≈ 0.686.
If precision is 1 and recall is 0.25, what is F1?
2(1)(0.25)/(1 + 0.25) = 0.4.
Common mistake
The F1 score uses a harmonic mean. Its formula does not include true negatives.
Quick check
Which two rates does F1 combine?
Show answer
Precision and recall.
What is F1 when both rates equal 1?
Show answer
1.
What is F1 if TP = 0 but FP or FN is positive?
Show answer
0 by the count formula.
Sources
Flashcard
F1 Score
Reveal the definition
The F1 score is the harmonic mean of classification precision and recall.
Effortless Math. “F1 Score.” Math Dictionary.



