Skip to content
ML to LLMs
Labs / Classical ML

Linear regression

Drag points, tilt the line, see residuals, MSE and MAE live, and toggle L1/L2 penalties.

Theory and worked examples: Linear regression

Linear regression lab

Synthetic data: y = 2x + 3 + noise. Drag any point.

Scatterplot with prediction line and residuals02.557.5100102030x (feature)y (target)
your lineleast-squares fitresiduals

Drag a point, move the sliders, or press “Gradient step”.

MSE is 19.22 above the best possible line. The slope gradient is -47.54, so gradient descent will increase w. MAE (3.92) grows linearly with error, so it reacts less than MSE when you drag a point far away.