Precision, recall, drift and the right metric for a model
Count a model's two kinds of mistake in a confusion matrix, pick precision or recall to fit the cost of each, and watch for drift after release.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: a smoke alarm. A smoke alarm can fail in two ways. If it is too sensitive, it shrieks over toast. If it is too dull, it misses the fire. Changing sensitivity often trades one error against the other, but this is not an impossibility rule: a perfectly separated test set can have neither false alarms nor misses.
Daily List is a to-do list app. Leo's urgent helper is an alarm for urgent tasks. It can flag a task that is not urgent. That is a false alarm. It can miss a task that is urgent. That is a missed fire. Tom wants to count both.
He uses a , a small table that counts the helper's right and wrong answers for each kind of answer. From it he works out : two numbers. Precision asks: of the tasks flagged, how many were truly urgent? Recall asks: of the truly urgent tasks, how many were caught?
After release the world can change. Users start to use Daily List differently. The helper meets tasks unlike the ones it learned from. That change is . A helper that was good in week one may be poor in week nine, with no change to its code.
The picture has limits. A smoke alarm has one dial, and a model can have many. A fire is clearly a fire, but whether a task is urgent can depend on who you ask.
(SYNTHETIC / TRAINING ONLY: Daily List and every person named in this lesson are invented.)
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.
THE REAL JOB Counting a model's two kinds of mistake, then choosing which one to guard against.
- Count both mistakes
- Read the table
- Pick by cost
- Watch for change
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| A loud alarm over toast | A false alarm |
| Missing a real fire | A missed case |
| The dial on the alarm | The cut-off |
| A change in how people cook | Data drift |
WHERE THIS PICTURE STOPS
- A smoke alarm has one dial. A model can have many.
- A fire is clearly a fire. Urgent depends on who you ask.
- Cooking habits change slowly. Data can change fast.
HOOK
Toast or fire.
REMEMBER IT THIS WAY
A contrast: two neighbours told apart by one test.
Precision asks: of the tasks flagged, how many were right? Recall asks: of the urgent tasks, how many did the helper find?
| In the trick | What it stands for |
|---|---|
| Precision | of the tasks flagged, how many were right |
| Recall | of the urgent tasks, how many were found |
TELL A FRIEND
A smoke alarm can shriek over toast or miss a real fire. You count both and choose which to guard against.
OFTEN MIXED UP WITH Testing AI and machine-learning features. The overview lesson asks how to judge a learned feature at all. This lesson gives the numbers to judge it with.
PRACTISE AND KEEP
Sources for this topic — 5 sources
- Market practice
Classification: accuracy, recall, precision and related metrics (Google Machine Learning Crash Course) ↗ — Google · Accuracy is a rough measure only when classes have similar counts; with rare positives a model that always predicts the common class scores high yet is useless; recall and precision are more meaningful, and all are computed at one fixed threshold (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Metrics and scoring: quantifying the quality of predictions (scikit-learn user guide) ↗ — scikit-learn project · The confusion matrix counts items by true group and predicted group; precision is true positives over true positives plus false positives (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: scikit-learn 1.9.1 documentation as seen in the excerpt. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
What Is Data Drift in Machine Learning (and How to Detect It) (Chalk blog) ↗ — Chalk · Data drift is a change in the distribution of input features in production compared with training while the model itself stays the same (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Artificial Intelligence Risk Management Framework, version 1.0 (National Institute of Standards and Technology) ↗ — National Institute of Standards and Technology · Test sets and metrics are documented, and systems are tested before release and while running (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
scikit-learn 1.9.1 — Validation curves and learning curves ↗ — scikit-learn developers · Actual scikit-learn 1.9.1 user guide §3.5.1 body read 6 November 2026: validation-based selection biases that score as a generalisation estimate; independent evaluation is needed after selection. Applied here to decision-rule selection, not a mandated business threshold.
Returned exact title/URL and version1.9.1 verified. This review does not claim opening linked API pages or visually reviewing/reproducing the embedded figures.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.