Class 9 · Unit 1: The AI project cycle, and ethics · Lesson 1.4 · 40 min
Modelling and evaluation
The sticky note says 94%. Hiba tests it on twenty real leaves. One mistake could cost an orchard its season.
Today you will: Write a rule-based model · Build a 2×2 table from real results · Say which mistake costs more, and to whom
Story
The leaf checker from last year still sits on the club laptop. Somebody has written 94% on a sticky note on the lid.
Hiba tests it on twenty leaves from an orchard in Shopian, writing down what the model said and what the leaf actually was. Then she draws a square divided into four.
The model called twelve healthy leaves healthy. It called five scabbed leaves scabbed. It called two healthy leaves scabbed — the grower would spray trees that did not need it. And it called one scabbed leaf healthy.
Bilal: “Eighty-five per cent. Still fine.” (reading the total.)
Hiba: “Look at the last box again. That one leaf is how an orchard loses a season. Two of these mistakes are not the same size.”
Watch
Two kinds of model, and four kinds of result — — scan code 9.1.4 in the printed book.
Warm up your fingers
Skill: the colon and the comparison operators (5 min)
-
typing.com symbols lessons, focusing on
:,>,<and=. -
Type this three times. It is the rule-based model you will write out in Part 1, in the form Unit 5 will use:
if snowfall_cm > 10: -
Term 1 goal: 32–38 WPM at 94% accuracy.
On the laptop
You need: LibreOffice Calc · leaf-results.ods (sheets Rules, Results, Matrix)
Mission 1: A rule-based model (8 min, in pairs)
- ☐1
Sheet Rules: write a rule-based model for winter attendance as three or four
if … then …lines. - ☐2
Beside it: what data does your rule need? What would a learning-based model need instead?
- ☐3
Mark the line everyone would argue about. A learning-based model would have decided it for you, silently.
Mission 2: The 2×2 table (12 min)
- ☐4
Sheet Results: twenty leaves — what the model said, what each really was.
- ☐5
In a cell, write what positive means: the leaf has scab.
- ☐6
Predict: which box will be biggest? Which smallest?
- ☐7
Sheet Matrix: fill the four counts with
COUNTIFS. Actual down the side, model said across the top:Model said scab Model said healthy Actually scab True Positive False Negative Actually healthy False Positive True Negative - ☐8
Accuracy:
=(TP+TN)/20*100. Then answer below the grid: which box would you shrink first — and what does the grower do after each kind of mistake?
Finished early?
Two models both score 85%. One makes only false positives, the other only false negatives. Which would you give the grower?
No laptop today?
Draw the grid on the board. Your teacher reads the twenty results; everyone tallies in their notebook, then works out the counts and accuracy by hand.
Now you know
- Modelling is stage four. Rule-based models are written by people; learning-based models find the rule from labelled examples.
- Rule-based is not a lesser choice. If you can write the rule, write it.
- Evaluation is stage five. Decide what positive means first — the thing you're looking for.
- Four boxes: True Positive and True Negative are right; False Positive is a false alarm; False Negative is a miss.
- Accuracy = (TP + TN) ÷ everything. It treats both mistakes as equal — and they almost never are.
🕌 From our heritage
Ibn Sīnā (980–1037) set out rules for testing whether a remedy really works, in the Canon of Medicine. One of them says that the trial must be repeated: if the effect appears only once, it may have been an accident, not the remedy at all. He also warned that a drug tested on a single complicated case tells you nothing, because you cannot say what caused what. Twenty leaves, honestly recorded, is that rule applied to a model — and the sticky note saying 94% is the single lucky trial he was warning about.
Source: Ibn Sīnā, al-Qānūn fī al-Ṭibb (c. 1025), Book II, on testing the effects of remedies.
Debate it
A hospital screening model is meant to catch a disease early.
- Would you rather it made false positives or false negatives? What happens to the patient in each case?
- The disease affects one person in a hundred. Describe a useless model that is "99% accurate".
- Who should decide the balance between the two mistakes — the engineer, the doctor, or the patient?
Check yourself — practice, not a test
1. Match each result to its name. Positive = the leaf has scab.
Scabbed leaf, model said scabbed · Healthy leaf, model said scabbed · Scabbed leaf, model said healthy · Healthy leaf, model said healthy
Match with: False Positive · False Negative · True Negative · True Positive2. An orchard model misses scab on infected trees. Which box is filling up?
- ○ True Positive
- ○ False Positive
- ○ False Negative
- ○ True Negative
3. Two models with the same accuracy are equally good.
- ○ True
- ○ False
4. A model whose rules are written by a person, not learned from data, is called ______-based.
5. When is a rule-based model the better choice? (choose all that apply)
- ○ When a person can state the rule clearly
- ○ When there is no training data
- ○ When someone must be able to read and argue with the logic
- ○ When the problem involves recognising faces in photographs
Remember
Accuracy hides which mistake you are making. The four boxes show it.