The Logistic Regression Coefficient That Goes to Infinity
Suppose you are fitting a logistic regression model to a binary classification dataset in using maximum likelihood estimation (via gradient ascent or Newton's method). The dataset is linearly separable: there exists a hyperplane such that all class-1 points satisfy and all class-0 points satisfy .
Question: What happens to the maximum likelihood estimate as training proceeds? Does the MLE exist? What does the log-likelihood surface look like, and what does this imply about convergence of the algorithm?
Answer: The Logistic Regression Coefficient That Goes to Infinity
Key Idea / Intuition
When the data are linearly separable, logistic regression can achieve zero training loss in the limit — but only by pushing the coefficient vector to infinity. The log-likelihood never actually attains its supremum; it approaches it asymptotically as along the separating direction. The MLE does not exist as a finite vector. This is a clean example where the optimization problem is unbounded above on the feasible domain, yet the algorithm keeps making progress forever.
Formal Proof / Solution
Setup. The logistic regression log-likelihood for observations with is:
where .
Step 1: Separability means the supremum is 0.
Note that always (since each term is a log of a probability ), and would require each predicted probability to be exactly 1 for class-1 points and exactly 0 for class-0 points. That would require for and for , which happens only in the limit .
Step 2: Along the separating direction, the likelihood increases without bound.
Let be a separating direction: and . Set for . Then:
- For : as (since ), so .
- For : as (since ), so .
Therefore as , so , but this supremum is never achieved at any finite .
Step 3: The MLE does not exist.
Since for all finite (probabilities are always strictly between 0 and 1 for finite inputs), and the sup is 0, the maximum is not attained. The log-likelihood surface is unbounded — there is no finite maximizer.
Step 4: Algorithmic consequence.
Any gradient-based optimizer (gradient ascent, Newton–Raphson) will keep increasing forever:
- The gradient never vanishes at a finite point.
- Newton's method may diverge or oscillate.
- Training accuracy reaches 100% quickly, but .
The norm of grows roughly like under gradient ascent, or even faster under Newton steps.
Step 5: The implicit bias connection.
A beautiful modern observation: gradient descent on logistic loss with separable data converges in direction to the maximum-margin classifier (the SVM solution). The coefficients diverge in norm, but converges to the hard-margin SVM hyperplane. So logistic regression, run long enough, secretly finds the SVM solution — even without any explicit margin constraint.
Summary table:
| Condition | MLE exists? | Training loss | |-----------|-------------|--------------| | Non-separable | ✓ Finite unique MLE | > 0 | | Separable | ✗ MLE | as |
Practical implication: In separable settings, you must use regularization (e.g., penalty ) to obtain a finite, well-defined solution. Ridge-penalized logistic regression always has a unique finite minimizer.
Source: The Elements of Statistical Learning, Hastie, Tibshirani, Friedman — Chapter 4 (Linear Methods for Classification)