F1 Score, and Choosing a Metric
Sometimes you genuinely cannot say whether a false positive or a false negative is worse. The F1 score exists for exactly that situation.
1What the F1 score is
F1 Score = 2 × Precision × Recall / (Precision + Recall)
Use it when the dataset is unbalanced and you are unable to decide whether FP or FN is more important. A high F1 score means a good balance between precision and recall.
Two wheels
2Working one out
Do it in three steps and write each one down — the marks are for the working, not just the final figure.
- Precision = TP / (TP + FP)
- Recall = TP / (TP + FN)
- F1 = 2 × Precision × Recall / (Precision + Recall)
Pick a metric to light up the cells it is built from. Precision is the top row; recall is the left column.
| Actual / Reality | ||
|---|---|---|
| Yes | No | |
| Predicted Yes | TP 50 | FP 40 |
| Predicted No | FN 12 | TN 10 |
Mobile phone sales prediction. Positive class: Phone sells. The board handed over the finished matrix and asked for the wrong predictions, then precision, recall and F1.Source: CBSE sample paper 2024-25
3Choosing between all four
| Use | When | Because |
|---|---|---|
| Accuracy | The classes are balanced and both mistakes matter equally | It counts every correct prediction, TP and TN alike |
| Precision | A false positive is the costly mistake | It punishes FPs and ignores FNs |
| Recall | A false negative is the costly mistake | It punishes FNs and ignores FPs |
| F1 Score | Unbalanced data and you cannot say which mistake is worse | It balances precision against recall in one number |
4From the board papers
(a) Accuracy and Precision (b) Precision and Recall (c) Recall and Accuracy (d) Recall and RealityCBSE sample papers 2023–24 and 2024–25
▶Show the answer
(b) Precision and Recall. Those are the only two quantities in the formula.
(i) Identify the total number of wrong predictions. (ii) Calculate precision, recall and F1 score.CBSE sample papers 2023–24 and 2024–25
▶Show the answer
Read the matrix first: TP = 50, FP = 40, FN = 12, TN = 10.
(i) Wrong predictions = FP + FN = 40 + 12 = 52.
(ii)
Precision = 50 / (50 + 40) = 50/90 = 0.5556
Recall = 50 / (50 + 12) = 50/62 = 0.8065
F1 = 2 × 0.5556 × 0.8065 / (0.5556 + 0.8065) = 0.8962 / 1.3621 = 0.6579
Note the shape of this result: recall is high and precision is poor, so the model finds most of the real sales but shouts “yes” far too often. F1 lands between the two, nearer the weaker one.
▶Show the answer
Accuracy = (150 + 750) / 1000 = 0.90 = 90%
Precision = 150 / (150 + 50) = 150/200 = 0.75
Recall = 150 / (150 + 50) = 150/200 = 0.75
F1 = 2 × 0.75 × 0.75 / (0.75 + 0.75) = 1.125 / 1.5 = 0.75
When precision and recall are equal, F1 equals them both — a useful check that you have not slipped up in the arithmetic.
▶Show the answer
(a) Precision. A real email wrongly binned as spam may never be read; a spam message getting through is a nuisance.
(b) Recall. Missing a real case of cancer is far worse than a false alarm, which further tests will clear up.
(c) Precision. Convicting an innocent person is the mistake the whole principle exists to prevent.
(d) Recall. A legitimate transaction flagged can be re-verified; a fraudulent one waved through cannot be undone.
(e) Recall. Blocking a harmless video is a small loss; letting an unsafe one reach a child is the failure that matters.
5Check yourself
A high F1 score generally suggests:
When should the F1 score be used?
A model has precision 0.75 and recall 0.75. Its F1 score is:
Which metric would you use where a false positive is the expensive mistake?