How a network learns: a loss that training lowers, gradient descent step by step, XOR that one neuron cannot learn, hard tasks that take longer, and whether the network will be right on new data too.
Step 1 of 6 · Random weights
Step 1 of 6
Random weights
A new network starts with random weights, so it guesses: on the XOR corners, with blue points in two opposite corners and orange ones in the other two, it is right on about half. The board shows the number of training steps and the share of points the network classifies correctly. Predict, and then the network will train.
Step 2 of 6
Training steps
To train, you measure how wrong the network is in one number, the loss: it is small when the network gives each point a value close to its true colour, and large when it is confident in a wrong answer. Then you move each weight a small step in the direction that lowers the loss, and repeat, again and again. Look inside shows the data on a board whose height is the network’s output, and the decision boundary, the line where the output is exactly .
Step 3 of 6
What changes
Move Training steps back and forth and watch the network: the links change thickness and colour, and the boundary moves.
Step 4 of 6
The loss
The method is called gradient descent: like a climber coming down a hill in fog, each time taking a small step down the steepest slope under their feet. It lowers the loss, not directly the number of mistakes. Predict what happens to the share right at first.
Step 5 of 6
A harder shape
In the Ring the orange points are in the middle and the blue ones round them. To split them, the boundary has to close round the centre.
Step 6 of 6
New data
The network trained on 80 points. But the aim of learning is not to know those points; it is to classify points not yet seen.
Loading the interactive version…
Loading the interactive version…
Each step sets up the Scene for you, and a control marked “fixed” stays put for that step.
Practice · Predict, then look
The network is untrained, with random weights: it is right on about half of the XOR corners. How many of the points will it classify correctly after 400 training steps?
Practice · Predict, then look
The network is untrained, with random weights: it is right on about half of the XOR corners. How many of the points will it classify correctly after 400 training steps?
Practice · Reach the target
Train the network on Two clusters: raise Training steps until it is right on all 80 points, and press Check.
Practice · Reach the target
Train the network on Two clusters: raise Training steps until it is right on all 80 points, and press Check.
Practice · Choose
Between one training step and the next, what changes in the network?
Practice · Choose
Between one training step and the next, what changes in the network?
Practice · Predict, then look
The network starts learning XOR, and at step 0 it is right on 55% of the points. What will happen to that share after 20 training steps?
Practice · Predict, then look
The network starts learning XOR, and at step 0 it is right on 55% of the points. What will happen to that share after 20 training steps?
Practice · Reach the target
Now the data is a Ring: blue points round a disc of orange ones. Raise Training steps until the network is right on at least 90% of the points, and press Check.
Practice · Reach the target
Now the data is a Ring: blue points round a disc of orange ones. Raise Training steps until the network is right on at least 90% of the points, and press Check.
Practice · Choose
The trained network is right on all 80 training points. Will it also be right on new points of the same kind?
Practice · Choose
The trained network is right on all 80 training points. Will it also be right on new points of the same kind?
Lesson complete. Every practice question here is done.