ML0200 Why Logistic ‘Regression’

Why is logistic regression called regression when it is actually a classifier? What exactly does it regress, and where does the classification happen?

Three dashed panels. Panel 1: 10,000 labeled radar detections shown as dots on two rows, y equals 1 for pedestrian and y equals 0 for clutter, plotted against micro-Doppler spread x in metres per second. Panel 2: detection 4182 with spread 4.0 metres per second feeds a logistic regression with weight 0.9 and bias minus 2.6, which outputs 0.73. Panel 3: an emergency braking module that needs brake or no brake, a sensor fusion module that needs a probability, and a question box where engineer A calls the model a classifier whose 0.73 is a score and engineer B calls it a regression

The Problem: A radar-perception team fits logistic regression on 10,000 labeled detections (pedestrian vs clutter) and gets 0.73 for detection #4182, which feeds both an emergency-braking module that needs a yes/no decision and a fusion module that needs a probability. Engineer A says the model is a classifier and 0.73 is just a score, engineer B says it is a regression, and nobody can say what the 0.73 actually is.

Answer

The name is accurate, because logistic regression never outputs a class on its own. It fits a linear model to the log-odds of the positive class and maps that unbounded score through the sigmoid to a probability p(x) = P(Y = 1 \mid x). For a 0/1 label that probability equals the conditional mean \mathbb{E}[Y \mid x], and estimating a conditional mean from features is exactly what regression means in statistics. Formally it is a generalized linear model with a Bernoulli outcome and a logit link, the same family as least squares and Poisson regression. It becomes a classifier only when a separate decision threshold t is applied to the probability, and that threshold comes from error costs rather than from the fit.

(1) Regression Means Conditional Mean: Since Galton, regression is the estimation of \mathbb{E}[Y \mid x] from predictors. For a binary target that mean is a probability, so predicting it is regression even though the label itself is discrete.
(2) The Linear Part Lives In Log-Odds: A probability is bounded in [0, 1], but the logit \log(p/(1-p)) ranges over the whole real line, so a linear predictor is legitimate there. The sigmoid is just the inverse link that maps it back.
(3) A Generalized Linear Model: Bernoulli family plus the canonical logit link gives logistic regression. Swap the link for the normal CDF and you get probit regression, swap the family for Poisson and you get count regression.
(4) Classification Is A Separate Decision Rule: The label comes from p(x) \geq t, which is the hyperplane w^\top x + b = \log(t/(1-t)). Changing t moves the boundary without refitting a single weight.
(5) The Fit Is Literally Regression: Maximum likelihood is solved by iteratively reweighted least squares, a sequence of weighted linear regressions on a working response. Coefficients read as log odds ratios, with standard errors and tests like any regression.

Mathematical Formulation:
p(x) = P(Y = 1 \mid x) = \mathbb{E}[Y \mid x]
\log \frac{p(x)}{1 - p(x)} = w^\top x + b
p(x) = \sigma(w^\top x + b) = \frac{1}{1 + e^{-(w^\top x + b)}}
\mathcal{L}(w, b) = -\sum_{i=1}^{N} \ell_i
\ell_i = y_i \log p_i + (1 - y_i) \log(1 - p_i)
\hat y = \mathbf{1}[p(x) \geq t]
t^{*} = \frac{c_{FP}}{c_{FP} + c_{FN}}

Where:

  • p(x) is the predicted probability that the label Y equals 1 for feature vector x. For a Bernoulli label it is also the conditional mean \mathbb{E}[Y \mid x].
  • w and b are the weights and intercept, w^\top x + b is the linear predictor (the log-odds), and \sigma is the logistic sigmoid, the inverse of the logit link.
  • \mathcal{L}(w, b) is the Bernoulli negative log-likelihood (binary cross-entropy), \ell_i is the per-example log-likelihood, i \in \{1, \ldots, N\} indexes training examples, y_i \in \{0, 1\} are labels, and p_i = p(x_i).
  • \hat y is the predicted class, \mathbf{1}[\cdot] is the indicator function, and t \in (0, 1) is the decision threshold, which is not a fitted parameter.
  • t^{*} is the expected-cost-minimizing threshold when a false positive costs c_{FP} and a false negative costs c_{FN}. It is valid only if p(x) is calibrated.

Notice that nothing in the first five lines mentions a class. The fit minimizes the Bernoulli negative log-likelihood, so the estimated p(x) is a regression estimate of a conditional mean, just with a bounded, S-shaped response. Classification enters only in the threshold rule. Because the logit is monotone, p(x) \geq t is the same as w^\top x + b \geq \log(t/(1-t)), which is why the decision boundary is a hyperplane and why moving t slides it without a refit.

Three-panel chart of one logistic model with log-odds equal to minus 2.6 plus 0.9 x. Panel a: in log-odds space the fit is a straight line through orange binned empirical log-odds points. Panel b: in probability space the sigmoid curve follows jittered 0 and 1 labels, while a dashed least-squares line fitted to the same labels rises above 1 at large x. Panel c: the same sigmoid with two horizontal thresholds; t equal to 0.5 puts the decision boundary at x equal to 2.89 and t equal to 0.1 moves it to x equal to 0.45, giving two classifiers from one fit

Figure 1: One fitted model, \log(p/(1-p)) = -2.6 + 0.9x, seen three ways. (a) In log-odds space the fit is a straight line through binned empirical log-odds, which is the regression. (b) The sigmoid maps it to p(x) = \mathbb{E}[Y \mid x], while least squares on the same 0/1 labels leaves [0, 1]. (c) A classifier appears only once a threshold is chosen: t = 0.5 puts the boundary at x = 2.89 and t = 0.1 moves it to x = 0.45 with no refit.

Worked Example:
The fitted model is \log(p/(1-p)) = -2.6 + 0.9x, with x the micro-Doppler spread in m/s. Detection #4182 has x = 4.0, so the regression output is the log-odds -2.6 + 0.9 \times 4.0 = 1.0. The odds are e^{1.0} \approx 2.72, which gives p = 2.72/3.72 \approx 0.731. The coefficient says each extra 1 m/s multiplies the odds by e^{0.9} \approx 2.46, a statement about a regression slope, not about a class. Now build two classifiers from this one fit. At the default t = 0.5 the boundary sits where the log-odds hit 0, at x = 2.6/0.9 \approx 2.89, so #4182 is labeled a pedestrian. If a missed pedestrian costs nine false brakes, then t^{*} = 1/(1+9) = 0.1, the boundary log-odds drop to \log(1/9) \approx -2.20, and the boundary moves to x \approx 0.45 without touching w or b.

The name also explains what logistic regression is not. Running ordinary least squares on 0/1 labels, the linear probability model, regresses the same conditional mean, but a straight line in probability space predicts values above 1 or below 0 at the edges of the feature range. Its errors also have variance p(x)(1 - p(x)) that changes with x. The logit link fixes both by putting the linear structure where the target is unbounded. A linear SVM sits on the other side: it learns only a separating hyperplane, so it is a classifier with no regression target at all.

PropertyLogistic regressionLinear regressionLinear SVM
What it modelsE[Y | x] for a binary Y, linear in the log-oddsE[Y | x] for a real-valued Y, linear in Y itselfOnly a separating hyperplane, no conditional mean
Raw outputA probability in (0, 1)Any real numberA signed margin score
LossCross-entropy (Bernoulli negative log-likelihood)Squared error (Gaussian negative log-likelihood)Hinge loss
FittingIRLS or gradient descent, no closed formClosed-form normal equationsQuadratic program or SGD
Where the class comes fromAn external threshold t chosen from error costsNot a classifier unless you threshold itBuilt into the loss at margin zero
Probability without extra stepYes, if the model is well specifiedNo, predictions can leave [0, 1]No, needs Platt scaling on held-out data

Login to view more content
Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *