How a neural network learns (perceptron)
Train the simplest artificial neuron to separate two groups of points, then find the pattern it can't learn, and why that led to deep learning.
- AI literacy
- Computational thinking
- Critical thinking
- Measuring & data
🧰 You will need
- 2 × White paper
- 1 × Pencils and crayons
🧠 From a single neuron to ChatGPT-style AI
Today’s AI models are built from millions or billions of tiny maths units called artificial neurons. In 1958, Frank Rosenblatt built the first one that could learn: the perceptron. Let’s train one.
🎮 Train the neuron
The neuron draws a straight line and says “red” on one side and “blue” on the other. Press Train and watch the line move. Then load the Tricky (XOR) pattern.
Accuracy: 30% · passes: 0
line: 0.20·x + -0.50·y + 0.30 = 0
Click the square to add points:
Points with a black ring are wrong. Train it and watch the line move.
🛠️ Do it by hand
The perceptron has three numbers: a, b and c. For a point (x, y) it calculates a·x + b·y + c. If the answer is 0 or more, it says red; otherwise blue.
- Start with a = 0.2, b = −0.5, c = 0.3. Take the point (−0.5, 0.2), which is red. What does the neuron say?
- If it’s wrong, learn: add 0.1 × x to a, 0.1 × y to b and 0.1 to c (subtract instead if the point is blue).
- Repeat for a few points on graph paper. Draw the line a·x + b·y + c = 0 after each update. Watch it move towards the right place!
- Try the XOR pattern: red at top-left and bottom-right, blue at top-right and bottom-left. Can any single straight line separate them?
💡 What happened?
- The neuron learns from its mistakes: each wrong answer nudges its numbers (called weights) a little in the right direction.
- If a straight line can separate the groups, the perceptron is guaranteed to find one eventually.
- But one neuron can only draw one straight line, so it can never solve XOR. In 1969, this famous limit slowed AI research down for years.
- The fix: connect layers of neurons, so each layer combines the lines from the one before into curves and shapes. Training many layers is called deep learning, and it powers today’s AI for images, speech and language.
Did it work?
🖨️ Printables for this experiment
Voltage–current graph sheet
Ages 13–15Worksheet
Record measurements, plot a V–I graph and find resistance from the slope.