Linear regression & loss
Drag points and fit a line. Watch MSE and MAE react to every outlier.
Drag points and fit a line. Watch MSE and MAE react to every outlier.
Tap empty space to add a point (8/16).
Linear regression finds the line y = mx + c that is “closest” to the data. Each red segment is a residual: how far the line misses a point. A loss function squashes all the residuals into one number.
Least squares picks the line with the smallest mean squared error. Squaring punishes big misses heavily, so a single outlier can drag the line towards it — the mean absolute error is far more relaxed.
Linear regression finds the line y = mx + c that is “closest” to the data. Each red segment is a residual: how far the line misses a point. A loss function squashes all the residuals into one number.
Least squares picks the line with the smallest mean squared error. Squaring punishes big misses heavily, so a single outlier can drag the line towards it — the mean absolute error is far more relaxed.
Things to try