Class 9 · Unit 3: Maths for AI · Lesson 3.4 · 40 min
Probability inside an AI decision
“Scab — 98% confident.” “Scab — 52% confident.” Same word. Should the uncle spray both trees?
Today you will: Read a confidence score as a probability · Find where the mistakes cluster · Set a line for when a person checks
Story
The leaf app gives Rahat's uncle two answers in a row.
Scab — 98% confident. He sprays that tree.
Scab — 52% confident. He is about to spray that one too, when Hiba stops him.
Hiba: “That second one is not the app telling you it is scab. That is the app telling you it could not decide.”
Both answers said the same word. Why should he treat them differently?
Watch
The number beside the answer — — scan code 9.3.4 in the printed book.
Learn it
A classifier never just says "scab". It says "scab, 98%" or "scab, 52%", and those are very different answers. The number is a confidence score: the probability from Lesson 3.3, produced by a machine. The scores across all classes add to 100%, so the model must always pick something; it has no way to say "I can't tell". That makes the score the place to look for doubt: mistakes cluster where confidence is low.
Words to know
- Confidence score the model's probability for its answer, like Scab 98%. It is not a verdict and not the model's accuracy.
- Class scores the scores for every class. With two classes they add to 100%, so the lowest a "winning" answer can be is just over 50%.
- Confidence band a range of scores grouped together: high (90% and above), middle (70–89%), low (below 70%).
- Threshold a line you choose, such as 70%. Below it, a person checks.
- Human check a person reviewing a prediction before anyone acts on it.
Step by step: setting a threshold for twenty predictions
| Band | Predictions | Wrong |
|---|---|---|
| high (90%+) | 12 | 0 |
| middle (70–89%) | 5 | 1 |
| low (below 70%) | 3 | 2 |
- Overall accuracy: 3 wrong out of 20 → 17 ÷ 20 = 85%.
- Split by confidence: the high band was never wrong; 2 of the 3 mistakes are in the low band.
- Try a threshold of 70%: a person checks the 3 low predictions (15% of the work) and catches 2 of the 3 mistakes.
- Try a stricter 90%: a person checks 8 predictions (40% of the work) and catches all 3.
- Choose: stricter lines catch more mistakes and cost more time. Which line is right depends on what a mistake costs, and how many people are available to check. That is a human decision.
🕌 From our heritage
Long before machines printed percentages, Muslim jurists were careful to distinguish yaqīn — certainty — from ẓann, probable knowledge, and from mere doubt. They held that much practical reasoning rests on ẓann al-ghālib, what is most probably the case, and they said so openly rather than dressing a likely answer as a certain one. A model's 52% is ẓann. The honesty is in naming it.
A standard distinction in uṣūl al-fiqh (the principles of jurisprudence); see the discussion of certainty and probability in the classical uṣūl literature. You met the branching questions of that tradition in Class 6.
Careful: a high score is not proof. A model trained only on sunny photos can be 98% sure about a shady leaf and still be wrong, because confidence only compares the classes it knows. Treat the score as a guide to where to doubt, never as a reason to stop checking.
On the laptop
Tool: LibreOffice Calc. File needed: unit-3/leaf-predictions.ods — twenty
predictions from the leaf classifier the class trained in Class 8. Column B is what the model
said, column C how confident it was, column D what the leaf actually was.
Mission 1: Your mission
- ☐1
In E2 type
=IF(B2=D2;"Right";"Wrong")and fill down to E21. - ☐2
In G2, overall accuracy:
=COUNTIF(E2:E21;"Right")/20*100. Write it down. - ☐3
Now split by confidence. In G4 count the high-confidence predictions:
=COUNTIFS(C2:C21;">=90"). In G5, how many of those were wrong:=COUNTIFS(C2:C21;">=90";E2:E21;"Wrong"). - ☐4
Repeat for the middle band in G7 and G8, using
">=70"together with"<90". - ☐5
Repeat for the low band in G10 and G11, using
"<70". - ☐6
Fill in this sentence in G13: "The model was wrong ____ times in twenty. ____ of those mistakes were predictions it was less than 70% sure of."
- ☐7
Make the rule. In G15, count how many photos fall below 70%:
=COUNTIFS(C2:C21;"<70"). In G16 write what fraction of the work that is, as a percentage. - ☐8
In G17 answer: if a person checks only those photos, how many of the model's mistakes would they catch, and how much of the work is that?
- ☐9
Try a stricter rule. Change the line from 70 to 90 and answer the same two questions. Which rule would you give the uncle, and why?
No laptop today?
Print the twenty predictions on cards and lay them on a desk in confidence order, highest to lowest. Turn over each card to reveal whether it was right. The wrong ones cluster at one end of the row, and the class can see the line where a person should start looking.
Debate it
A hospital screening tool flags possible disease in chest X-rays. It is 94% accurate overall, and its mistakes cluster below 75% confidence.
Where would you set the line for a doctor to look, and what would it cost to set it too high? Answer for a hospital with two radiologists and four hundred X-rays a day.
Check yourself — practice, not a test
1. A model outputs "Scab 52%, Healthy 48%". The best reading is:
- ○ The leaf is definitely scabbed
- ○ The model is 52% accurate
- ○ The model could not decide between the two
- ○ The model is broken
2. In a two-class model, the confidence scores always add up to ______%.
3. A model's mistakes are spread evenly across all confidence levels.
- ○ True
- ○ False
4. Moving the human-check line from 70% up to 90% will:
- ○ Catch fewer mistakes and cost less work
- ○ Catch more mistakes and cost more work
- ○ Catch more mistakes and cost less work
- ○ Make no difference to either
5. Why is a confidence score useful? (choose all that apply)
- ○ It shows where the model is least reliable
- ○ It lets a team decide what a human should check
- ○ It proves the model is right
- ○ It turns one answer into a probability you can reason about
Remember
A confidence score tells you where to doubt. The line for a human to look is your decision, not the model's.
Typing practice
4 minutes on typing.com: accuracy under thought.
- Term 2 lessons. Target 94%.
- Then type
COUNTIFSand>=ten times each. Today's formulas use both, and>=typed as=>is the error you will hunt for five minutes.