TwiddleLab / Artificial Intelligence / How a Neural Network Thinks
Measuring Wrongness
What you will learn
- The gap between a point and the line is an error.
- Square every error and take the average: that's the loss, or mean squared error. Lower is better.
- Squaring makes one big miss count more than several small ones.
- Predicting a number with a line is called regression.
How the lesson goes
Two lines try to predict how many levels a player clears.
Both miss all 6 players. Which line is better? Tap it, then Check.
Drag the line and watch the counter.
The orange sticks are the misses. Swing the line from bad to good and back.
A better meter: square every miss and take the average.
Turn the tilt until the meter drops under 0.5 and turns green.
Let's name the pieces.
Tap to reveal.
Each gap between a point and the line is an error.
Square every error: a square on each gap. Big gaps make huge squares.
The average of the squares is the loss, full name mean squared error. Predicting a number like this is regression.
Be the meter. Three misses: 1, 1 and 4.
Drag each corner to build a square on its miss. The tally adds the cells.
Game: beat the machine. Loss under 0.1.
Turn m and b. Every turn you let go of is a move. Fewer moves, more stars.
A new player joins: 2 hours of practice, 12 levels a day.
The line predicts about 4. Drag the marker to where the loss will jump, then Check.
The same meter works on a school graph.
A week of temperatures. Drag both ends of the trend line until the average squared miss is under 1.
Line A misses three players by 1. Line B misses one player by 3.
Which line has the smaller loss? Tap it, and Check turns on both meters.
Mystery: a ball sits on a hill in the fog.
This hill is the loss for every possible line. Tap the ball.
Previous lesson: A Line Separates the Classes · Next lesson: Rolling Down the Loss · Part of the course: How a Neural Network Thinks
Lessons are interactive and need JavaScript. Turn it on to play them.