Train a tiny neural network, see its connections change, and test whether it has learned from examples.
Last lesson, you adjusted how strongly colour and shape affected a decision. Could a computer learn how to adjust its connections using examples instead?
In this lesson you will train a real, tiny neural network with two inputs, two hidden neurons and one output. It is intentionally limited to four fruit descriptions, not photographs. You do not need to understand the calculations.
Make your prediction first. Help opens once you've locked it in.
The network really adjusts its internal numbers during training. The connecting lines give you a glimpse of those changes, but you do not need to decode every line.
Important: During testing, the network uses its existing learned connections. Testing a fruit does not change the weights. Training does.
Train the network, then record at least one prediction.
Use the board. This ticks when you get there.
Identify which part of the model changes when it learns from examples.
Explain why choosing a fruit to test does not itself teach the network.
Explain why a network can improve on its training examples and still struggle with something new.
A programmer designs the network's structure and how training works. Training adjusts its internal connections. Its prediction can change even though nobody rewrites a rule such as “yellow means banana.”
First choose Only yellow bananas, press Reset network, and train. Test a green, round fruit. What has the network not had the chance to learn?
Then select Use all examples, Reset network, train again and compare. You can also investigate the incorrect-label checkbox. Keep the same test fruit when comparing runs.
Wider investigation: Choose Show internal numbers. These values are connection weights (multipliers), not percentages or separate rules. Some may be negative, and none has to correspond to a human-readable feature. Can the same output change when several connections change together?
Without using the board, complete these statements:
Modern AI systems can be useful even when we cannot easily explain their learned internal patterns. We might inspect individual numbers without understanding what they collectively represent.
Imagine an AI assistant makes a confident claim in a subject you are learning. What would you verify independently? What work should you practise yourself before asking AI for help?
Takeaway: a neural network's behaviour changes as training adjusts its connections. Its predictions come from those learned numbers, not from a list of rules someone wrote.
Chatbots are neural networks too: very large ones, trained on huge amounts of text to predict the next word. That is the same next-word idea from Unit 1, with far more examples and connections.
Next: your sorter, your neural network and your dice generator are different kinds of AI. The next lesson names four kinds and how each goes wrong.
Lesson done. You've finished every step you need.
Train and test a genuine tiny neural network without teaching the mathematics. About 30 minutes.
Open the teacher guide: answers, solutions, slides and a worksheet.
The board uses a small genuine 2-2-1 sigmoid neural network with backpropagation. It sees only colour and shape, not photographs. No account or online model is needed. The lesson ends by linking back to Unit 1: chatbots are very large neural networks trained to predict the next word. Optional extension, with school approval: train an image model in the Pattern Trainer (https://tools.learningwaypoints.com/trainer/, photos stay on the computer; Teachable Machine also works) and test photos not used in training. An image model processes much richer information than two hand-chosen clues; neither guarantees correct predictions.
Students may think testing a new fruit automatically retrains the model.
Stretch: Show optional connection numbers; ask why they are not percentages.
Support: Start with all examples and compare one fruit before and after 100 training steps.
The last lesson of Unit 2 names four kinds of AI (rules, predict or sort, make new content, take actions) and how each goes wrong.