What are MLE and MAP estimation?
Maximum likelihood estimation (MLE) picks the parameter values that make the observed data most probable. Maximum a posteriori (MAP) estimation multiplies the likelihood by a prior over the parameters first, so it picks the most probable parameters given the data. With a flat prior the two give the same answer. With little data, the prior pulls the MAP estimate toward values that were plausible beforehand.
Most model training is one of the two. Minimizing mean squared error is MLE under Gaussian noise, and minimizing cross-entropy is MLE for a classifier's predicted probabilities. Adding an L2 penalty or weight decay turns that into MAP with a Gaussian prior on the weights, and an L1 penalty corresponds to a Laplace prior.
Key ideas
- The likelihood is the probability of the observed data viewed as a function of the parameters.
- MLE picks the parameters that maximize the likelihood; for coin flips it gives p̂ = k/N.
- Maximizing the log-likelihood gives the same answer as maximizing the likelihood.
- With small samples, MLE can give extreme estimates such as p̂ = 0.
- MAP maximizes likelihood × prior, so the prior acts as a regularizer.
- A Gaussian prior on weights gives L2 regularization, and a Laplace prior gives L1.
Common questions
What is the difference between MAP and full Bayesian inference?
MAP keeps a single point, the peak of the posterior. Full Bayesian inference keeps the whole posterior and averages predictions over it, which also gives a measure of uncertainty. MAP is much cheaper, but it ignores how wide the posterior is.
Is minimizing mean squared error the same as maximum likelihood?
Yes, when the targets are the model's output plus Gaussian noise with a fixed variance. The negative log-likelihood is then Σ(y − f(x))² / (2σ²) plus a constant, so minimizing it is the same as minimizing squared error. With heavy-tailed noise, MLE gives a different loss, such as absolute error for Laplace noise.
Is the maximum likelihood estimate always unbiased?
No. The MLE of a Gaussian's variance divides by N and is biased low, which is why the sample variance divides by N − 1. MLE is consistent, though: under standard conditions it converges to the true parameter as N grows.
What is the EM algorithm?
Expectation-maximization finds MLE or MAP estimates when the model has hidden variables, such as which cluster produced each point in a Gaussian mixture. It alternates between estimating the hidden variables from the current parameters and re-fitting the parameters to those estimates. Each round never lowers the likelihood, though it can stop at a local maximum.
Related explainers
- Probability & Distributions — Spam, densities, and the math of uncertainty
- Bayes' Theorem — Updating beliefs with evidence
- Regularization — Dropout, L1, and L2 — keeping models honest
- Loss Functions — How networks measure their mistakes
- Naive Bayes Classifier — Probabilistic classification with Bayes' rule
- Statistics Essentials — Mean, variance, standard deviation, and the Central Limit Theorem
References
- Goodfellow, Bengio & Courville (2016), "Deep Learning", chapter 5: Machine Learning Basics
- Bishop (2006), "Pattern Recognition and Machine Learning", chapters 2–3
- Murphy (2022), "Probabilistic Machine Learning: An Introduction" (free online edition)
- Dempster, Laird & Rubin (1977), "Maximum Likelihood from Incomplete Data via the EM Algorithm", JRSS Series B
Last updated