Why can’t you just use linear regression for classification? What goes wrong with the predictions and the decision boundary?

The Problem: A team building gift prediction for a live-streaming app such as Bigo Live fits least squares on 0/1 labels for 8 sessions and cuts the score at 0.5, which separates them cleanly at 25 minutes watched. The scores already run from -0.17 to 1.17, and after one 200-minute gifter is added the 30-minute gifter drops to 0.49 and is predicted to send nothing.
Answer
You can fit least squares to 0/1 labels and cut the score at 0.5, and on clean, balanced data it often separates the classes about as well as logistic regression. The trouble is that it optimizes the wrong objective for the wrong output space. Its predictions lie on an unbounded straight line, so scores like -0.17 or 1.25 appear and cannot be read as probabilities. Squared loss also charges confidently correct points, so a far-away example on the right side still pulls the line toward itself and slides the 0.5 crossing past nearby points. Logistic regression fixes both by passing the score through a sigmoid and training with log loss, whose gradient fades to zero once a point is classified with confidence.
(1) Unbounded Scores: ranges over the whole real line, so scores below 0 and above 1 are routine. They cannot drive a decision that needs a probability, such as a cost-weighted threshold or an expected-revenue estimate.
(2) Squared Loss Punishes Being Too Right: A positive scored 1.5 costs , exactly as much as a borderline positive scored 0.5. The fit therefore bends toward confidently correct points instead of ignoring them.
(3) Boundary Pulled By Leverage: The per-point pull grows without limit, so one far-away, correctly labeled example tilts the line and slides the 0.5 crossing past nearby points of its own class.
(4) Wrong Noise Model: Least squares is the maximum-likelihood fit for Gaussian noise with constant variance, but a 0/1 label is Bernoulli with variance . Standard errors, R-squared, and any probability reading of the scores inherit that mismatch.
(5) The Fix Is The Loss: Logistic regression keeps a linear boundary but models with a sigmoid and trains on log loss, whose gradient
is bounded and vanishes for well-classified points.
Mathematical Formulation:
Where:
is the least-squares score for a feature vector
(here a single feature, minutes watched), with weights
and intercept
. In one dimension
is a scalar slope.
is the label of example
, and
is the sum of squared errors that least squares minimizes.
is the pull example
exerts on the fit. It grows linearly with the residual on either side of the label, so a score of 6 on a positive pulls as hard as a score of -4.
is the one-dimensional least-squares decision boundary, the feature value where
crosses 0.5.
is the logit,
the sigmoid, and
the predicted probability of class 1, always strictly between 0 and 1. The logistic boundary is
, which is still a linear boundary.
is the Bernoulli negative log-likelihood. Its gradient
lies between -1 and 1 and goes to 0 as a correct prediction becomes confident.
Worked Example:
Take eight sessions: no gift at 5, 10, 15, 20 minutes and a gift at 30, 35, 40, 45 minutes. Least squares gives , which crosses 0.5 at exactly 25 minutes and classifies all 8 correctly, yet already scores the 5-minute session at -0.17 and the 45-minute gifter at 1.17. Now add one heavy gifter (a “whale”) who watched 200 minutes. The old line scores that point 6.33, a squared error of
against 0.33 for the other eight combined, so the refit must flatten:
. The 0.5 crossing moves to about 32.0 minutes, the 30-minute gifter falls to 0.49 and is misclassified, and training accuracy drops from 8/8 to 8/9 although the new point was the easiest positive in the data. A lightly L2-regularized logistic regression on the same nine points keeps its boundary at 25.0 minutes, because the whale’s log loss is below
and contributes no gradient.

Figure 1: (a) Before the far gifter, least squares (gray) and logistic regression both cut at 25 minutes. One correctly labeled 200-minute gifter flattens the least-squares line (orange), its 0.5 crossing slides to about 32 minutes, and the 30-minute gifter falls to 0.49. The logistic boundary (blue) stays at 25 minutes. (b) The full range shows the cause: the old line would have scored that gifter 6.33, and even the refit scores it 1.25, outside the shaded valid range.
Both models draw a linear boundary, so the difference is not the shape of the boundary but where the loss places it and what the output means. The table lines the two up on the properties that matter for a classifier.
| Property | Least squares on 0/1 labels | Logistic regression |
|---|---|---|
| Output range | Any real number, e.g. -0.17 or 1.25 | Strictly between 0 and 1 through the sigmoid |
| Loss | Squared error (y – y_hat)^2 | Log loss (Bernoulli negative log-likelihood) |
| Confidently correct point | Still penalized; pull 2(y_hat – y) grows without bound | Pull p – y shrinks toward 0 |
| Far, correctly labeled example | Tilts the line; cut slides from 25 to 32 minutes | Boundary stays at 25 minutes |
| Implied noise model | Gaussian with constant variance | Bernoulli with variance p(1 – p) |
| Decision boundary | Linear, where the score equals 0.5 | Linear, where the logit equals 0 |
| Fitting | Closed form via the normal equations | Iterative (Newton or gradient descent) on a convex loss |
Leave a Reply