CoursesAIMathCodePhysicsAbout and FAQ

TwiddleLab / Artificial Intelligence / How a Neural Network Thinks

Measuring Wrongness

Lesson 4 of 10 · 6 min · Free, no account needed

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.

Start the lesson

How the lesson goes

  1. Two lines try to predict how many levels a player clears.

    Both miss all 6 players. Which line is better? Tap it, then Check.

  2. Drag the line and watch the counter.

    The orange sticks are the misses. Swing the line from bad to good and back.

  3. A better meter: square every miss and take the average.

    Turn the tilt until the meter drops under 0.5 and turns green.

  4. 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.

  5. Be the meter. Three misses: 1, 1 and 4.

    Drag each corner to build a square on its miss. The tally adds the cells.

  6. 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.

  7. 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.

  8. 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.

  9. 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.

  10. 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.

Loading TwiddleLab