Glossary · Phase 3 · Machine learning
Least squares
Fitting a model by choosing the weights that make the sum of squared errors as small as possible.
Try it now
Drag the sliders to fit the line by eye, then press Best fit to see what least squares finds.
Learn it properly
Linear regression · Fit a line, and predict numbers from features. About 30 minutes.
Other terms from the same lesson
- bias: In a model, a starting value added before anything else (the intercept). It can also mean a systematic error; the context tells you which.
- intercept: In a straight-line model, the prediction when every feature is 0: where the line crosses the vertical axis.
- linear regression: Predicting a number with a straight-line formula: a weight for each input, added up, plus a starting value.
- R²: How much better a model predicts than always guessing the average: 1 is perfect, 0 is no better, and below 0 is worse.
- residual: How far one prediction missed: the true value minus the predicted value.
- sum of squared errors: Square each prediction's miss and add them all up. Squaring makes every miss count as positive and big misses count much more.
- weight: An adjustable number inside a model that says how much an input matters. Training sets the weights.
Never trained an AI?
Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.