Core Algorithms
Regression: Fitting Lines That Predict
7 min+65 XPStep 1/9
Draw the line that explains the data
Plot house price against square footage and the points form a cloud trending upward. Regression asks: what single straight line captures that trend best?
'Best' has a precise meaning. Each point has a residual — the vertical gap between the real price and the line's prediction. Least squares picks the line that minimizes the sum of squared residuals.
analogy
Like lowering a ruler onto a scatter of points and tilting it until the points hug it as tightly as possible — the residuals are the gaps you can't close.