ch 04 / 12Classical machine learning
slide 01 / 10
Predict a continuous value

Linear regression

Predict a scalar from a feature: y^=wx+b\hat y = w x + b. Choose w,bw, b to minimise the mean squared error:

L(w,b)=1Ni=1N(yiwxib)2\mathcal{L}(w, b) = \frac{1}{N}\sum_{i=1}^{N}(y_i - w x_i - b)^2

Closed form: w^=(XX)1Xy\hat w = (X^\top X)^{-1} X^\top y. Drag the sliders; the yellow rays are residuals — their squared lengths sum to the MSE.

xy
MSE = 0.177