Home › Blog › Career Guide
Career Guide · November 2026 · 8 min read

Machine Learning Model Evaluation — Accuracy, Precision, Recall and F1 With a Worked Example (2026)

Why accuracy alone can mislead

A model that is right 95% of the time sounds excellent. But if only 10% of cases are positive, a model that always predicts 'negative' is already right 90% of the time. Evaluation is about choosing the metric that matches the cost of each kind of mistake.

The confusion matrix

Imagine a spam filter tested on 1,000 emails, of which 100 are spam.

Predicted spamPredicted not spam
Actually spamTP = 80FN = 20
Actually not spamFP = 30TN = 870

The metrics worked out

MetricFormulaResultMeaning
Accuracy(TP + TN) ÷ total95.0%Share of all predictions that were right
PrecisionTP ÷ (TP + FP)72.7%When it says spam, how often is it right?
Recall (sensitivity)TP ÷ (TP + FN)80.0%Of the real spam, how much did it catch?
F1 score2 × precision × recall ÷ (precision + recall)0.76One number balancing precision and recall
SpecificityTN ÷ (TN + FP)96.7%Of the real non-spam, how much was left alone?

The accuracy trap: a model that labels every email 'not spam' scores 90% accuracy here yet catches no spam at all, so its recall is 0%.

Which metric to favour

SituationFavourWhy
Missing a case is costly, such as disease screening or fraudRecallBetter to flag too many than miss real cases
False alarms are costly, such as blocking genuine emailsPrecisionAvoid disrupting legitimate activity
Classes are imbalanced and both errors matterF1Balances the two

Thresholds and the trade-off

Most models output a probability and you pick a cut-off. Lowering it raises recall and usually lowers precision. An ROC curve or precision-recall curve shows this trade-off across all cut-offs, and the area under the ROC curve summarises overall ranking quality.

Good habits

Related: A/B testing basics, Python for data science and portfolio projects.

Building a data career?

Talk to an advisor about data science programmes that fit your background.

Frequently Asked Questions

What is the difference between precision and recall?

Precision asks how many flagged items were truly positive; recall asks how many true positives were caught.

Why can high accuracy be misleading?

With imbalanced data, always predicting the majority class gives high accuracy while missing every positive case.

What is an F1 score?

The harmonic mean of precision and recall, giving one number that balances both.

How do I choose a threshold?

Pick the cut-off that suits the relative cost of false positives and false negatives in your problem.

📞 CallFree counselling ★