All 12 lessons

Lesson 5 of 12 · How machines learn

Teach a machine by example

Groups write a rule from labelled leaf cards, test it on cards the teacher held back, count their accuracy and improve the rule.

Or print one part

In the print dialog choose A4, scale 100% (or Default) and turn on Background graphics for the coloured parts. Choose Save as PDF to keep a file.

Lesson 5 of 12 · How machines learn · Teacher's plan

Teach a machine by example

Groups write a rule from labelled leaf cards, test it on cards the teacher held back, count their accuracy and improve the rule.

Students will be able to

  • write a simple rule from labelled examples
  • explain the difference between training data and testing data
  • work out accuracy as the number right out of the number tested
  • explain why more and more varied examples usually give a better rule

Prepare

  • For each group: 8 training cards, each showing a leaf with its features and a label (Tree A or Tree B)
  • 6 testing cards with the same features but no label, kept by the teacher
  • An answer key for the testing cards
  • One worksheet per student

Words to know

Label:
The right answer attached to an example, such as "Tree A".
Training data:
Labelled examples used to learn a rule.
Testing data:
New examples kept back to check whether the rule works.
Accuracy:
How many answers were right out of how many were tried, such as 5 out of 6.

Main activity · Unplugged: paper and pens

The leaf sorter

Groups study labelled leaf cards (shape, edge, length, colour) and write a rule for telling Tree A from Tree B. The teacher then shows held-back cards, groups apply their rule, count how many they got right and improve it, which is how machines are trained and tested.

ManuAI pages for this lesson

The 45-minute plan · 45 minutes

Warm-up6 min

How did you learn that?

  • Ask: "How did you learn to tell a cat from a dog?" Nobody gave you a rule book.
  • Agree that we learn from many examples with names attached. Introduce the word label.
  • Say that today groups will be the machine.
Activity18 min

Train, then test

  • Give each group its 8 training cards. Groups look for features that separate Tree A from Tree B.
  • Each group writes one rule, for example "long leaf with a smooth edge means Tree A".
  • Show the 6 testing cards one at a time. Groups write their answer for each using only their rule.
  • Read out the answer key. Groups count right answers and write their accuracy, such as 4 out of 6.
  • Ask: "Why did we keep the testing cards hidden?" Draw out that testing on new examples is the only fair check.
Practice16 min

Improve the rule

  • Give each group 4 more training cards, including the kinds that tricked them.
  • Groups rewrite their rule and test it again on the same 6 cards.
  • Students fill in the worksheet, comparing the first and second accuracy.
  • Compare groups: did more examples help? Did any rule get worse by being too fussy?
Wrap-up5 min

Train, test, improve

  • Write the cycle on the board: train, test, count, improve.
  • Note that a real AI does this with thousands or millions of examples, and it is still never 100 percent right.
  • Hand out the exit ticket.

Teacher tips

  • Making cards: draw simple leaves by hand and write the features under each one (shape, edge smooth or jagged, length in cm, colour). Make two or three cards in each set that break the obvious pattern so groups get something wrong the first time.
  • Mixed levels: groups who score 6 out of 6 quickly can write a rule using two features together, or try to write a rule that is too strict and show how it fails on testing cards.
  • Misconception: "the machine understands leaves". It only follows the features and patterns in its examples. If a feature it relies on is missing on a new card, it will guess badly.

Exit ticket answers

  1. A group's rule got 9 out of 12 testing cards right. What is its accuracy? A. 9 out of 12 (three quarters)
  2. Which data should be kept back and only used at the end to check the rule? C. Testing data
  3. Why does giving a machine more and more varied examples usually help? A good answer: It sees more of the kinds of case it will meet, so its rule fits real examples better and makes fewer mistakes on new ones.
Free to print and share in classrooms and at home.ManuAI · free AI lessons for everyone · ai.manusignal.com

Worksheet · Lesson 5 of 12 · How machines learn

Be the machine

NameClassDate

Use your group's leaf cards. Write a rule, test it, then make it better.

  1. 1Our first rule for telling Tree A from Tree B:

  2. 2Record your answers for the testing cards.

    Testing cardOur answerRight answerCorrect? (yes or no)
    1
    2
    3
    4
    5
    6
  3. 3Accuracy of the first rule: ___ out of 6. Accuracy of the improved rule: ___ out of 6. What changed?

  4. 4Why do we test the rule on cards the group has never seen?

    • To make the lesson longer
    • Because the training cards are worn out
    • To check if the rule works on new examples, like a real machine would meet
    • Because testing cards are easier
  5. 5A rule that is right on every training card can still fail on new cards. Why might that happen?

Free to print and share in classrooms and at home.ManuAI · free AI lessons for everyone · ai.manusignal.com

Cut along the dotted lines: two tickets per page.

Exit ticket · Lesson 5ManuAI

Teach a machine by example

NameClassDate

  1. 1A group's rule got 9 out of 12 testing cards right. What is its accuracy?

    • A9 out of 12 (three quarters)
    • B12 out of 9
    • C3 out of 12
    • D100 percent
  2. 2Which data should be kept back and only used at the end to check the rule?

    • ATraining data
    • BThe labels
    • CTesting data
    • DThe rule itself
  3. 3Why does giving a machine more and more varied examples usually help?