Lesson 6 of 10 in this unit
Different mistakes have different costs.
Move a threshold, count different errors, and defend a decision using precision, recall and explicit costs.
By the end: Calculate a confusion matrix and its rates, compare a majority baseline, and explain how error costs change a threshold decision.
Prerequisites and path options
Why learn this? Choose when to act on a prediction by comparing the consequences of different kinds of error.
Start with something concrete.
Only 4 of 20 equipment requests need urgent attention. A system that says “ordinary” every time gets 16 right: 80% accuracy. Yet it misses every urgent request. Before trusting a score, ask which mistakes the number hides.
Try the interactive modelKeep all urgency scores fixed and lower the threshold. What must happen?
Change one thing. Watch what follows.
Loading this browser experiment…
Understand what changed.
A shorter explanation, with the original worked examples available below. Both explain the same experiment and its limits.
The idea in everyday terms
A score ranks or estimates a case; a threshold turns that score into an action. Lowering the threshold usually catches more positive cases but also sends more negative cases for action. “Positive” names a class, not a desirable outcome.
What to watch in the experiment
Count correct alerts, false alerts, misses and correct rejections. Each rate divides by a particular group, so read its denominator. Compare thresholds using the costs and review capacity relevant to the task, rather than choosing accuracy alone.
What this does not establish
A threshold change does not improve the underlying score. Rates with an empty denominator are undefined, and selecting a threshold on these public cases is development, not fresh final evaluation.
Open the full worked examples, calculations and limitations
This is the same reference used in Technical mode. Expand it whenever you need the exact numbers, assumptions or further explanation.
Start with the decision, not the percentage
An equipment desk can review only some requests urgently. A score ranks requests; a threshold is the cutoff for action. In this lesson, “positive” means urgent. It does not mean good, correct, or desirable. A true label says what actually happened, while a prediction is the system’s decision.
At threshold 0.50, a request scoring 0.60 receives urgent review and one scoring 0.35 does not. Lowering the threshold to 0.35 includes both. The model has not learned anything new: its scores are unchanged. Our supplied scores are invented rankings, not calibrated probabilities. A score of 0.80 does not establish an 80% chance of urgency.
Four boxes reveal the mistakes
The live matrix crosses the actual outcome with the predicted outcome. “True” means correct; “false” means incorrect. Positive and negative refer to the prediction.
| Count | Plain-language meaning | Default worked example |
|---|---|---|
| True positive, TP | Urgent and flagged urgent | 3 |
| False positive, FP | Ordinary but flagged urgent: a false alarm | 3 |
| False negative, FN | Urgent but missed | 1 |
| True negative, TN | Ordinary and correctly left unflagged | 13 |
These are the worked-example defaults, with 20 requests and threshold 0.50. The lab’s matrix and calculations change with your controls. There are four truly urgent requests (TP + FN) and six alerts (TP + FP). Count those groups before dividing.
Three rates answer three questions
Accuracy asks how many decisions were right overall: 16 out of 20, or 80%. Precision asks how many alerts were right: 3 out of 6, or 50%. Recall asks how many truly urgent requests were caught: 3 out of 4, or 75%.
Each symbol is a count from the table. The fractions are unitless rates from 0 to 1; multiply by 100 to express percentages. Read precision as “correct alerts divided by all alerts,” and recall as “caught urgent requests divided by all urgent requests.” They exchange the denominator, not the numerator.
With no alerts, precision has denominator zero and is undefined. It is not 100% and not evidence of a reliable detector. With no actual positives, recall is undefined. An empty sample has no accuracy. The lab labels these cases rather than silently inserting a favorable number.
Accuracy can reward doing nothing useful
The majority baseline always predicts the most common class. On the default cohort it predicts ordinary and achieves 16 / 20 = 80% accuracy, exactly matching the default score rule. But its recall is zero: it misses all four urgent requests. The score rule catches three. This is why class balance—the relative numbers in each class—and the intended use matter.
Changing the displayed mix removes twelve ordinary requests while retaining the four urgent ones. This illustrates sensitivity to the sample. It also changes the ordinary-score distribution, so it is not an isolated population-prevalence experiment. A small teaching cohort does not establish future performance or subgroup fairness.
Turn assumptions into an explicit cost
Suppose each unnecessary review costs 2 points and each missed urgent request costs 10 points. The default rule costs 3 × 2 + 1 × 10 = 16 points. Predicting ordinary for everyone costs 4 × 10 = 40. Costs express our teaching assumptions about consequences; they are not measured money or universal values.
C is total cost in points, c with subscript FP is cost per false alarm, and c with subscript FN is cost per miss. This model assumes constant costs per error, zero cost for correct decisions, and unlimited review capacity. Real decisions may need different costs for different cases, a review-capacity constraint, and human escalation.
Lowering the default threshold to 0.35 catches all four urgent requests but also creates five false alarms. At the original costs that is 10 points; if false alarms cost 10 and misses cost 2, it is 50 points. A threshold preference depends on the use and costs, not on a universally best cutoff of 0.50. Compare thresholds on the same cohort, since total cost also grows with the number of requests.
Separate practice from a release decision
Changing thresholds after inspecting outcomes is development. Choose the metric and costs, select a threshold on development evidence, freeze it, and then evaluate on fresh cases collected for the intended use. Reusing this tiny cohort cannot create new independent evidence. Examine affected groups, review workload, uncertain labels and future changes before recommending deployment.
Use the lab’s separate library calculation to practice the denominators. For a decision brief, record two compared thresholds, the counts and costs, your assumptions, and the next evidence you need. For implementation practice, build and test the count-and-rate function yourself, including the zero-denominator and exact-threshold cases. Neither a downloaded brief nor passing the lesson’s practice question certifies independent implementation or decision quality.
A new detector flags 10 items: 8 are truly faulty and 2 are sound. It also misses 4 faulty items. Which statement is correct?
Take this idea with you.
Name the positive class, show the counts, state the costs and compare a baseline before choosing a threshold. Freeze the choice before fresh evaluation. A completed practice brief is not a reviewed deployment decision.
Explore related topics and the topic map
How this topic connects
Explore this topic on the interactive mapUse these connections to review a foundation or choose where to go next. You can open any topic without completing the others.
What it builds on
- Percentages
Work with ratios and percentages so you can compare counts, errors and costs on the same basis.
- Data quality and splitting
Repair a dataset without letting answers leak into training and make evaluation look better than it is.
Move a threshold, count different errors, and defend a decision using precision, recall and explicit costs.
What it enables
- How much should a small result convince you?
Judge how much confidence a small sample deserves before making a larger commitment.
- Who receives the errors?
Find who bears a model’s errors and decide where limited human review can help.
- Explain what your model is for
Give other people enough context to decide whether your model fits their task and its limits.
Show 4 more connections
- Start with a simple baseline
Find out whether a complicated model adds value over a cheap, understandable reference.
- Predict a class probability
Separate fitting a class probability from choosing the threshold used to take action.
- Find unusual examples
Set inspection priorities while recognizing that an unusual measurement is not necessarily a fault.
- Update beliefs from evidence
Combine new observations with prior information instead of treating each positive signal as certainty.