Lesson 9 of 17 · 40 minutes

How does a machine learn?

Train a simple sorting model on example cards, find the shortcut it learned and repair its training data.

Download this lesson (PDF)Share to Google Classroom

Student handout

Try one together

Every dog photo I show a model was taken on grass. It may learn “grass means dog.” Then it calls a cat on a lawn a dog. It found a pattern, just the wrong one.

Sorty the recycling robot

The Make & Mend Club is teaching a sorting robot named Sorty. Sorty never reads the bin rule. It only sees labelled cards. You are the club’s model trainer. The robot and its cards are invented.

Evidence cards

Work the class case together

  1. Play the robot. Using only the starter cards, write the simplest rule that gets all eight right. Use your rule on the three new items and check each answer against the bin rule.
  2. Design three new training cards that would break Sorty’s shortcut. For each, say what it shows Sorty that the starter cards could not.
  3. Check the shared sheet against the bin rule. Decide which cards Sorty may learn from. Name the security goal the unsigned cards threaten and one safeguard from lesson 2 that would protect the sheet.

Train the Sorter

Grades 7–8 · 15–20 minutes

You played the robot on paper. Now train the real Sorty, watch its score on items it has never seen and decide which cards it should learn from.

  1. Train Sorty on the starter cards and test it. Record the clue it sorts by and its score on the six new items.
  2. Add up to four extra cards and retrain. Keep going until Sorty sorts by the clue that matters and has seen every material on the test.
  3. Inspect the unsigned cards. Leave out any whose label breaks the bin rule, then choose a safeguard for the shared sheet.

What to turn in. Hand in Sorty’s first rule and score, the cards you added and why, and the safeguard you chose for the shared sheet.

Share this lab to Google Classroom

Words for this case

Training data
The examples a model learns from.
Label
The answer attached to a training example, such as “recycle” or “trash.”
Model
The pattern a computer builds from its training data and then uses on new cases.
Prediction
A model’s answer about something it has not seen before.
Data poisoning
Slipping wrong or misleading examples into training data so the model learns the wrong thing.

Try this if you’re stuck. Sort the starter cards into two piles. Look for one thing every card in the recycle pile shares. Then ask whether that thing is the real reason those items can be recycled.

Take it further. Sorty has never seen glass. What should a well-built sorter do with a glass jar: guess, or say it does not know and ask a person? Defend your choice.

Exit ticket

A model gets 8 out of 8 on the cards it trained on. Why is that not enough to trust it? What would you test next?

Skill unlocked · Model Trainer. Tick it on your skill tracker once you can explain your exit ticket answer to a partner.

Teach this lesson

  1. 4 minutes · Play guess my rule with six classroom objects sorted by a rule you keep secret. Add one object that fits two possible rules and ask how students could find out which rule you meant.

  2. 8 minutes · Introduce the terms with the worked example. As a class, play the robot on the starter cards and write the simplest rule that fits. Test it on the three new items.

  3. 18 minutes · Give each pair Train the Sorter in its browser or paper edition. One partner chooses cards while the other predicts Sorty’s new rule before each retraining. Swap roles for the unsigned cards.

  4. 5 minutes · Ask where bad training cards could come from and who should be allowed to add them. Connect the answer to integrity in lesson 1 and least privilege in lesson 2.

  5. 5 minutes · Give the exit individually. Collect one reason a perfect training score is not enough and one test on unseen items.

What to look for

Students identify the color shortcut, choose counterexamples on purpose and explain that a model must be tested on items it has not seen. They treat wrong labels as an integrity problem and propose limiting who can edit.