Interactive notebook
Linear vs. Logistic
The same machinery predicting a number versus predicting a probability.
fit y = 0.519x + 0.723r² 0.673MSE 0.805points 16
- Least-squares fit
- Residuals
Drop an outlier far from the line and watch the whole fit tilt toward it — squared error punishes big misses disproportionately.
The plot supports pointer dragging and keyboard editing. Linear regression minimizes the sum of the squared dashed residuals. Squaring is what makes it solvable in closed form — and also what makes it fragile: one point twice as far away contributes four times the error, so outliers get a vote far larger than their share.