aNet.ai
Machine Learning/Learning path
0day streak0XP · Lv 1
← 6. Linear Regression
Lesson 3 of 9 8 min · 149 words

Least squares

Choosing weights that minimise the sum of squared residuals.

The residual of example is , the vertical gap between the point and the line. Ordinary least squares (OLS) chooses the weights that minimise the sum of squared residuals:

Squaring makes every residual positive, penalises large errors more than small ones, and gives a smooth convex bowl with a single minimum that can be found exactly. Statistically, least squares is the maximum-likelihood estimate if the noise is Gaussian.

The downside: squaring makes OLS sensitive to outliers — one point far from the rest can drag the line towards it. Robust alternatives use absolute or Huber loss.

Formula to remember

Normal equation

Closed-form least-squares solution.

Quick check · +5 XP

R² = 0 means the model…

Practice this topic
Saved in this browser as you type.
aNet.ai · Introduction to Machine Learning · NewUU course outlineProgress saved in this browser