Why Machine Learning Squares Its Mistakes (MSE by Hand)

Why does machine learning square its errors? Work out mean squared error by hand with just three data points.

Introduction

Why Square Errors?

Why does machine learning square its mistakes? Let's find out in fifty seconds.

  • Mean squared error
  • Three data points

Actual vs Predicted

Say three real values are three, five, and eight. Your model predicts two, six, and four.

  • Actual: 3, 5, 8
  • Predicted: 2, 6, 4

Find the Errors

The errors are one, minus one, and four. Negatives would cancel, so we square them.

  • Errors: 1, -1, 4
  • Negatives cancel out

Square Each Error

One squared is one. Minus one squared is one. Four squared is sixteen.

  • 1 squared = 1
  • (-1) squared = 1
  • 4 squared = 16

Add and Average

Add them: eighteen. Divide by three. The mean squared error is six.

  • 1 + 1 + 16 = 18
  • 18 divided by 3 = 6

Big Errors Dominate

Notice something. One mistake of four made up sixteen of the eighteen. Big errors get punished hard.

  • 16 of the 18 total
  • One big miss rules

Penalty Grows Fast

Double an error, and its penalty quadruples. That forces the model to fix its worst mistakes first.

  • Double error, 4x penalty
  • Worst mistakes fixed first

A Bowl to Roll Down

And squaring makes a smooth curve, a bowl with one clear bottom. Gradient descent rolls down it.

  • Smooth curve
  • One clear bottom
  • Gradient descent next

Next: Gradient Descent

Follow for the next video, where we roll downhill.

  • Follow for more