Everyone imports LinearRegression from scikit-learn and moves on. Today we build it by hand — and you'll see that "training a model" is just a line sliding into a cloud of points.

This is Day 1 of MachineLearningFromZero: every core algorithm built from scratch, no black-box library.

The model is two numbers

let m = Math.random(), b = Math.random(); // slope + intercept

const predict = x => m * x + b; // ŷ = m·x + b