← AI Foundations

How does a machine learn?

Teach a simple fruit sorter using labelled examples, then test unfamiliar fruit.

We are moving beyond choosing words with dice. Now we will investigate how a model uses examples and clues to classify something new. Our Waypoints model is deliberately simplified: it is not a modern neural network.

Kind of AI: a model that learns to predict or sort from labelled examples. Unit 1's generator was a different kind: one that makes new content.

How this lesson works: Engage, Explore, Explain, Elaborate, Evaluate
Extra examplesYour teacher may tell you which.
EngageCommit to a prediction before you test anything. A wrong guess is fine: it shows you what to look for.

Engage: Predict before testing

A sorter has only seen yellow, long bananas. Can it reliably recognise every banana?

ExploreTry it on the board and compare what happens with your prediction.

Explore: Investigate a fruit sorter

The model sees only two clues: colour (green or yellow) and shape (round or long). Real fruits are more varied. Predict its answer first, then choose clues and press Predict label. Compare the result with your prediction.

Look at the labelled examples. Test a yellow, long fruit and a green, round fruit. What does the model do when the clues do not clearly match one kind?

Try it yourselfYour edits are saved in this browser.

Test at least two fruits with different clues.

Use the board. This ticks when you get there.

ExplainPut a name to what you saw, and why it works.

Explain: What did the model use?

Explain which examples or clues the model used.

Explain why a prediction can be wrong even when the model follows its procedure.

Describe one way you could test or improve the model without automatically trusting its output.

When the sorter answers for a green, long fruit it was never shown, it is generalising: using what similar examples have in common to handle something new. Remember the dice lookup table from Unit 1? It had no row for a new phrase, so it was stuck. A model that generalises is not stuck, but it can still be wrong.

Examples and labels shape predictions; a test case is not automatically proof. The toy sorter compares simple clues with nearby examples, rather than training a neural network.

On the board, one training example reads: yellow | round | apple. Which part is the label?

No training example is green and long. You test a green, long fruit and the sorter says banana. What does that show?

Elaborate Extra · typicalUse the idea in a new situation.

Elaborate: Change and test

Add a correctly labelled example of a yellow, round banana. Test the same clues before and after adding it. Explain what changed.

Wider investigation: Try a case where the same two clues could describe different real fruits. What additional information might help? Explain why a better dataset may help without guaranteeing a correct answer.

Try it yourselfYour edits are saved in this browser.

EvaluateLook back at your first ideas and what changed.

Evaluate: Judge a new prediction

Without using the model, write: One thing I understand about how this model works is … One thing I would check before trusting its output is …

Your friend's sorter was taught only yellow fruit. It calls a green, round fruit a banana. What is the most likely reason?

EvaluateLook back at your first ideas and what changed.

Learning with AI: you can't see its examples

On the board you could see every example. A real AI assistant learned from far more examples than you could ever read, and you can't see them. So when it gives you a confident answer, ask: what might it have learned from? Better examples often help a model, but they can't guarantee a good answer.

Now you can
Next lesson5. Why does AI make mistakes?Break a fruit sorter on purpose with a wrong label and with missing examples, then fix it.
For teachers

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

Open the teacher guide: answers, solutions, slides and a worksheet.

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.

The hard part (on purpose)

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

When students get stuck

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.

Where it leads

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