What is the difference between MLE and MAP estimation, and how can you show that L2-regularised linear regression is MAP with a Gaussian prior?
Probability and statistics, Estimation
Level L3 Intermediate. Length Medium. Nature Th+Mat Both.
What's being asked
Whether you can connect regularisation to Bayesian priors, instead of treating it as a trick.
Key idea
MLE (maximum likelihood estimation) maximises , the probability of the data given the parameters . MAP (maximum a posteriori) estimation maximises , where is the prior. Taking negative logs, a prior with variance adds to the loss.
Steps
- Define MLE: . The log turns a product over data points into a sum, which is easier to optimise.
- Define MAP with Bayes’ rule. Drop the evidence , because it does not depend on .
- For linear regression with weights , training pairs and Gaussian noise of variance , write .
- Add . Multiplying through by gives ridge regression with , where is the penalty strength.
- Note that a Laplace prior gives L1 (lasso) in the same way. MAP is still a point estimate, not a full posterior.
Common mistakes
- Calling MAP “Bayesian inference”. It ignores posterior uncertainty.
- Getting upside down.
- Forgetting that MAP is not invariant to reparameterisation (rewriting the model in terms of a transformed parameter), while MLE is.
- Putting the Gaussian prior on the intercept too. The prior goes on the weights only; the intercept effectively gets a flat prior, which is why ridge leaves it unpenalised (or centres the data first).
How long your answer should be
2–3 minutes: the definitions, then a three-line derivation.
Read this
Previous in Probability and statistics: You pick door 1 out of three, one of which hides a car. The host, who knows where the car is, always opens a different door that has a goat and offers you a switch. He opens door 3. Using Bayes' rule, what is the probability that the car is behind door 2, and why is the host's knowledge important?
Next in Probability and statistics: Is KL divergence a distance, and why is minimising cross-entropy the same as maximum likelihood?