Linear Regression: How a Machine Learns a Straight Line

Out of the infinitely many lines you could draw through a set of points, how does a machine find the best one? We derive linear regression from first principles — no memorising formulas, every step animated. By the end you'll understand the four-step recipe that trains almost every model in machine learning: define a model, define a loss, take its gradient, and walk downhill.