Paul's Python CoursePPC

Mean squared error

Not met yet

The mean squared error says how wrong a set of predictions is, in one number: square each miss (prediction minus actual), then take the mean. Squaring stops misses above and below from cancelling, and makes one big miss cost more than several small ones. It's in the answers' units squared, dollars squared for house prices; its square root, the root mean squared error, is back in dollars. Lower is better, and 0 means every prediction was exact.

Try it

main.py

Output

Press Run and what your program prints shows up here.

Easy to get wrong

  • Thinks adding up or averaging the raw misses measures how wrong a line is, so misses above and below cancel.
  • Thinks a line that is exactly right on most points must have a lower mean squared error than one slightly off on all of them.
  • Thinks the mean squared error is the mean miss, squared, rather than the mean of the squared misses.
  • Thinks the mean squared error is in the same units as the readings, rather than those units squared.

Where it comes up