The Softmax That Forgets Its Past: Logistic Regression and Sufficient Statistics
Suppose you have binary labels and a feature vector . You fit logistic regression, which models:
Now consider a different scenario: you are told that within each class, the features are Gaussian with a shared covariance matrix:
with class priors .
The question: Using Bayes' theorem, compute under this generative (LDA) model. What do you notice? What does this say about the relationship between logistic regression and Linear Discriminant Analysis (LDA)?
Follow-up to ponder: LDA has more parameters than logistic regression. Does fitting more parameters make LDA better? When would LDA beat logistic regression, and when would it lose?
Answer: LDA Is Secretly Logistic Regression
Key Idea / Intuition
The stunning fact is that when the class-conditional distributions are Gaussian with equal covariances, the posterior is exactly a logistic sigmoid of a linear function of — the same functional form as logistic regression. So LDA is a special case of logistic regression in terms of the decision boundary shape. The difference lies in how the parameters are estimated: LDA uses a generative model (more assumptions, more parameters to estimate), while logistic regression fits the boundary directly (fewer assumptions, estimates only ). This tradeoff reveals a classical bias-variance story.
Formal Proof / Solution
Step 1: Apply Bayes' theorem.
Dividing numerator and denominator by the numerator:
Step 2: Plug in the Gaussian densities.
With :
Expanding (the terms cancel because is shared):
Step 3: Collect into a linear form.
Define:
Then:
This is exactly the logistic regression form.
Step 4: The punchline — what's different?
| | Logistic Regression | LDA | |---|---|---| | Model | directly | , then invert | | Parameters estimated | | (many more) | | Assumes Gaussian ? | No | Yes | | Decision boundary | Linear in | Linear in (same form!) |
Step 5: When does each win?
-
LDA wins when the Gaussian equal-covariance assumption is actually true: it uses the extra information from modeling , giving a lower-variance estimator of . LDA is more statistically efficient in this regime.
-
Logistic regression wins when the Gaussian assumption is wrong (e.g., binary features, skewed distributions): it makes no assumption on , so its estimates are not biased by a false generative model. It is more robust.
This is the canonical efficiency vs. robustness tradeoff in statistics: parametric generative models win when correct, semiparametric discriminative models win when the generative assumptions fail. ESL (Section 4.3) calls this the "Analysis of the Difference Between LDA and Logistic Regression."
Bonus insight: If instead the covariances differ (), the terms do not cancel, and the posterior becomes quadratic in — this is Quadratic Discriminant Analysis (QDA), which gives curved decision boundaries.
Source: The Elements of Statistical Learning, Hastie, Tibshirani, Friedman, 2nd ed., Section 4.3