Best Fit: lose to the machine

Eighteen students: hours studied vs test score. Drag the amber handles to draw your line of best fit. Every point grows a square — its area is that point's squared error. The machine draws the one line with the least total square area. Try to beat it.

Drag the amber handles (or focus one and use the arrow keys). Each square's side is that point's vertical miss; its area is the squared error. "Best fit" means smallest total area — that is all the phrase has ever meant.

The scoreboard

Your total square area
--
Extra error vs the machine
--
Machine's line (least squares)
--

The wait, what?

A line through the middle of the cloud — flat, sensible-looking — hides enormous squares at the ends. The machine's line often looks wrong: pulled by the extremes, cutting through the crowd. It wins for one boring reason: when you add up every square, its total area is the smallest any line can achieve.

“Least squares” is not a taste or an aesthetic. It is the definition of best — and every model you will ever meet is fighting for exactly this kind of shrinking area, in more dimensions than you can draw. Same game, more directions.