TwiddleLab / Artificial Intelligence / How a Neural Network Thinks
Project: Train Your Own
What you will learn
- Accuracy is the share of points a network gets right. The test set gives the honest one.
- More hidden neurons draw more complex boundaries. The network size that's just big enough is best.
- One epoch is one pass over the training data. The learning rate sets how big each step is.
- The recipe: collect, label, pick a network, train, test on new data, fix.
How the lesson goes
Two kinds of points, twisted into a spiral. No line can split them.
How many points can one straight line get right anyway? Drag the marker to your guess, then Check.
Warm-up: one neuron, two clouds of points.
Press Train and watch the shading: it's what the neuron believes about every spot.
New data: an orange disk inside a blue ring.
Draw where you think one neuron's line will go. Then press Train one neuron.
Give it a hidden layer.
Add hidden neurons with + and press Train. Get the ring to 95%, then Check.
How to score a network, in AI words.
Tap to reveal.
Accuracy is the share of points the network gets right. 47 of 50 right is 94%.
The number of hidden neurons is the network size. Bigger networks can draw more complex boundaries.
One epoch is one pass of the training loop over all the training data: predict, measure the loss, adjust every weight.
Same ring, three neurons. Now you set the learning rate.
Pick a learning rate and press Train: you get 200 epochs. Reach 90%, then Check.
Open the network. Which hidden neuron draws the right edge?
Tap a hidden neuron: it opens as a cup and shows its own line. Find the one on the right, then Check.
Project: train a network on the spiral.
Set the neurons, the learning rate and the epochs, then Train. The score that counts is the test set: points the network never trains on.
Is your network bigger than it needs to be?
Same learning rate and epochs. Remove neurons until the test score breaks under 90%, then fix it with the smallest network that holds. Check.
A bird app learns to name birds from photos. Build its recipe.
Put the 6 stations in order: it's everything you did in this course.
Training accuracy 99%, test accuracy 71%. What now?
You trained a neural network. Here's your card.
Your network from the project, with its real numbers. Tap Share to make it a picture.
Previous lesson: Why Networks Get Fooled · Part of the course: How a Neural Network Thinks
Lessons are interactive and need JavaScript. Turn it on to play them.