← Teacher guide

How does a machine learn?

Students teach a fruit sorter with labelled examples, test fruit it has never seen, and add an example to change what it predicts.

AI Foundations · How AI learns · about 30 minutes · Open the student lesson

Classroom resources

Open these in Waypoints Prepare with one click. To share a file another way, copy its address and paste it into Load URL, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.

Students will be able to

Before class

The board is a transparent teaching model: it copies the label of the nearest examples. It is not a neural network. The two clues (colour and shape) are deliberately too few for real fruit; let students find this. Optional extension, with school approval: train an image classifier in the Pattern Trainer (https://tools.learningwaypoints.com/trainer/, photos stay on the computer; Teachable Machine also works) with two fruit classes and test photos not used in training. Ask the same questions: what examples were used, what did it predict, what surprised you? A real image classifier learns much richer features than the board. The board alone is the complete core route.

Running the lesson

  1. Engage: ask what a sorter taught only long yellow bananas would do with other bananas.
  2. Explore: insist on a prediction before each test.
  3. Explain: name the parts of an example: the clues and the label.
  4. Elaborate: test the same fruit before and after adding an example.

In class

On the slides at these points. Students can do the whole lesson on their own; these are for the room. In the deck, the Run, Modify and Make slides have the live playground in them (the tutorial link is the backup), and the notes above are in each slide's speaker notes.

Diagrams

A flowchart of the fruit sorter. It keeps its labelled examples. A new fruit comes in. The sorter finds the closest examples and copies their label. Then ask: is the new fruit like any example it has seen? If yes, the prediction is probably right. If no, it is a guess: check it.
Explain it to me. How the sorter makes a prediction

The hard part (on purpose)

Students may treat a prediction as a fact, or think the sorter 'knows' fruit.

When students get stuck

What you will seeA question to askThe fix
A student says the sorter knows what a banana is.What does it actually look at? What does it do with a new fruit?Point to the nearest examples in the table and show it copies their label.

Answers to the checks

  1. Engage: predict before testing: A sorter has only seen yellow, long bananas. Can it reliably recognise every banana?
    Not necessarily. The examples shape the patterns it uses, and real bananas vary.
  2. Explore: investigate a fruit sorter: Test at least two fruits with different clues.
  3. Identify the evidence: On the board, one training example reads: yellow | round | apple. Which part is the label?
    apple
  4. Test the claim: No training example is green and long. You test a green, long fruit and the sorter says banana. What does that show?
    It can sort at least one fruit it was never shown
  5. Evaluate: judge a new prediction: Your friend's sorter was taught only yellow fruit. It calls a green, round fruit a banana. What is the most likely reason?
    It had no green examples to compare with
    With no green examples, it copied its nearest yellow ones.

Solutions

One possible solution for each task. Other correct programs are fine.

Elaborate: change and test

Open task: any program that does what the step asks.

Stretch and support

Stretch: Find a fruit description where the sorter is unsure. What example would settle it?

Support: Do one test together: predict, test, and find the examples it copied.

Exit ticket

Why can adding one example change a sorter's prediction?

The sorter copies its nearest examples, so a new nearby example can change which label wins.

Where it leads

Unit 2, lesson 2 breaks the sorter on purpose with wrong labels and missing examples.