Accuracy, precision and recall: one worked example
By Future Data Academy · 3 min read · Updated
Compare a majority baseline with a classifier using a confusion matrix, then connect precision and recall to review capacity and error costs.
A high accuracy score can hide the errors that matter most. Before choosing a metric, name the event you want to detect and what happens when your system misses it or raises a false alarm.
Consider a synthetic set of 100 support cases. Ten genuinely need escalation and 90 do not. Our goal is to flag cases for human review, not to make an automatic high-stakes decision.
Build the confusion matrix
A candidate flags 15 cases. Seven really need escalation and eight do not. It misses three of the ten escalation cases and correctly leaves 82 ordinary cases unflagged.
| Outcome | Count |
|---|---|
| True positive: correctly flagged escalation | 7 |
| False positive: ordinary case flagged | 8 |
| False negative: escalation missed | 3 |
| True negative: ordinary case not flagged | 82 |
The counts total 100. Always check that the positive class and denominator are clear before calculating metrics.
Calculate three different answers
Accuracy is (7 + 82) / 100 = 89%: the share of all decisions that are correct. Precision is 7 / (7 + 8), approximately 46.7%: the share of flagged cases that truly need escalation. Recall is 7 / (7 + 3) = 70%: the share of real escalation cases found.
These figures describe different questions. Precision tells the reviewer how much of the flagged queue is relevant in this sample. Recall describes how many relevant cases the system captures. Neither metric alone describes the whole workflow.
Compare with a simple baseline
A system that never flags anything gets 90% accuracy because it correctly labels the 90 ordinary cases. Its recall is zero. Its precision has a zero denominator, so any software convention used to report it must be stated.
The candidate has lower accuracy than that baseline but finds seven real escalation cases. Whether this is worthwhile depends on the cost of misses, the burden of false alerts and the team's ability to review the queue. The numbers do not decide the trade-off for you.
Test the operating threshold
If the model produces scores, a lower threshold usually flags more cases, affecting both the true and false alerts. Evaluate the trade-off on validation data. If reviewers can handle only 12 cases, a queue of 15 is already beyond capacity; assuming all flagged cases are resolved would overstate the benefit.
Choose metrics and a threshold before final test evaluation. Do not repeatedly tune against the held-out test set. If the frequency of the event changes in deployment, precision can also change, so retain the population and time period with every report.
Practise the interpretation
Write two sentences: one describing the measured performance, and one explaining a limitation. For example: “The candidate finds seven of ten escalation cases in this synthetic sample, while generating eight false alerts. This small example does not establish performance on future support cases.”
Continue with Classification and Model Evaluation and the guide to preventing data leakage. The scikit-learn metric reference explains implementation options and edge cases.
