The idea
You have data and a family of models indexed by a parameter . Every candidate assigns the observed data some probability. Maximum likelihood says: choose the that made what you saw least surprising.
In practice you always work with the log-likelihood : the product becomes a sum, underflow disappears, derivatives are clean, and the argmax is unchanged. The recipe is mechanical: write , differentiate, set to zero, check the second derivative is negative.
Three reasons this one idea keeps reappearing:
- It recovers the obvious estimators. The MLE of a Bernoulli is the sample proportion; of a Poisson or Gaussian , the sample mean. The principled machinery agrees with intuition on easy cases, which is what licenses trusting it on hard ones.
- It is what your loss functions secretly are. Least squares is MLE under Gaussian noise; cross-entropy is the negative Bernoulli/categorical log-likelihood; Poisson regression's loss is the negative Poisson log-likelihood. "Pick a noise model, take negative log" generates most of the standard losses.
- It has strong guarantees — asymptotically. MLEs are consistent (converge to the truth), asymptotically normal (enabling standard errors and Wald tests), asymptotically efficient (no unbiased estimator does better in the limit), and invariant (MLE of is ).
The fine print: those guarantees are large-sample. In small samples MLEs can be biased — the Gaussian variance MLE divides by instead of — and with sparse data they hit degenerate boundary answers, like estimating a probability of exactly zero because an event never occurred in 20 trials. The standard fix is a prior: MAP estimation maximizes likelihood prior, and its negative log is exactly "loss + regularizer".
Worked example
Ten independent trials, seven successes. Model: Bernoulli.
Differentiate and solve:
Numeric sanity check (natural logs):
| 0.5 | |
| 0.7 | |
| 0.9 |
wins, and note the asymmetry: 0.9 is worse than 0.5 despite being the same distance from 0.7, because those three failures are very improbable under — the of a small probability is savagely negative. That asymmetry is the same mechanism that makes cross-entropy punish a confident wrong prediction so much harder than a hedged one.
Cheat sheet
Recipe: write → solve → verify .
| Model | MLE | Note |
|---|---|---|
| Bernoulli / binomial | sample proportion | |
| Poisson | sample mean | |
| Gaussian | sample mean | |
| Gaussian | biased low; unbiased uses | |
| Exponential | via invariance from mean |
Loss ↔ likelihood dictionary:
- Squared error ↔ Gaussian noise
- Cross-entropy / log loss ↔ Bernoulli or categorical likelihood
- Absolute error ↔ Laplace noise
- L2 penalty ↔ Gaussian prior (MAP); L1 penalty ↔ Laplace prior (MAP)
Properties (large ): consistent · asymptotically normal · asymptotically efficient (Cramer-Rao) · invariance: .
Gotchas:
- Small-sample bias: variance MLE divides by ; use for unbiased.
- Zero-count boundary estimates () break downstream multiplication — smooth with a prior (Laplace/add-one, or Beta prior).
- Likelihood is a function of with data fixed; it is not a probability distribution over — it need not integrate to 1, and turning it into requires Bayes and a prior.
- MLE properties assume the model family contains (or nearly contains) the truth; under gross misspecification the MLE converges to the best in-family approximation, not the truth.