MLE and MAP
Formal
Both MLE and MAP are answers to the same question: given observed data drawn i.i.d. from a model with parameters , what is the best estimate of ?
(Maximum Likelihood Estimation)
Find the that makes the observed data most probable:
In practice, the product is replaced by a sum using the log-likelihood (log is monotone, so the argmax is unchanged):
(Maximum A Posteriori)
Incorporate a prior belief about the parameters via Bayes’ theorem:
MAP is MLE with an additional log-prior term. As , the data overwhelms the prior and MAP MLE.
(MLE and Standard Loss Functions)
The connection between MLE and common loss functions:
| Likelihood assumption | MLE objective | Equivalent loss |
|---|---|---|
| Maximise log-likelihood | Minimise MSE | |
| Maximise log-likelihood | Minimise Binary Cross-Entropy | |
| Maximise log-likelihood | Minimise Cross-Entropy |
(MAP and Regularisation)
The connection between MAP and regularisation:
| Prior on | MAP objective | Equivalent regulariser |
|---|---|---|
| Maximise log-posterior | L2 / Ridge — | |
| Maximise log-posterior | L1 / Lasso — |
This shows that regularisation is not a heuristic — it is Bayesian inference with a specific prior.
Intuition
MLE asks: “Given my model structure, what parameter settings would have been most likely to generate the data I actually saw?” It is fitting to the evidence.
MAP asks the same question, but with a constraint: the parameters should also be plausible given prior beliefs. It is fitting to the evidence, penalised by implausibility.
The SWE analogy: MLE is maximum-likelihood config tuning based purely on observed traffic. MAP is the same but with a regularisation term that says “don’t drift too far from the default config” — a prior over reasonable settings.
ML Applications
- All standard loss functions — as shown in the table above, minimising MSE or cross-entropy is MLE. This means every gradient-descent training loop is implicitly performing MLE.
- Ridge and Lasso regression — follow directly from MAP with Gaussian or Laplace priors respectively.
- Naive Bayes — estimates using MLE (or with Laplace smoothing, MAP).
- Expectation-Maximisation (EM) — a coordinate ascent algorithm for MLE when the model has latent variables. Used in GMMs, Hidden Markov Models, etc.
- Bayesian deep learning — treats the entire weight vector as a random variable; MAP gives point estimates while full Bayesian inference gives uncertainty estimates.
Connections
- Forward Links:
- Backward Links: Bayes Theorem, Common Probability Distributions, Covariance Matrix