LearnQuestion bank

Define MLE and MAP. Show that L2-regularised linear regression is MAP under a Gaussian prior. When does MAP differ materially from MLE?

ML engineeringTechnicalMedium

Answer it yourself first, out loud or on paper, then compare.

Answer

Model answer, written in a candidate's voice

In short

  • MLE maximises p(data|θ); MAP maximises p(data|θ)p(θ), i.e. likelihood times prior.
  • Gaussian noise + zero-mean Gaussian prior on w gives squared loss plus (σ²/τ²)||w||².
  • MAP differs materially with small n, many parameters, weak/ill-conditioned data, or informative priors; it converges to MLE as n grows.
  • Both are point estimates and do not give full uncertainty; a posterior predictive integrates over the posterior.

In full

MLE picks θ to maximise the likelihood p(data|θ), while MAP picks θ to maximise the posterior p(θ|data) ∝ p(data|θ)p(θ), so it adds a prior penalty to the likelihood. For linear regression with y = Xw + ε, ε ~ N(0, σ²I), the likelihood is proportional to exp(-||y-Xw||²/(2σ²)); with a zero-mean Gaussian prior w ~ N(0, τ²I), the posterior is proportional to exp(-||y-Xw||²/(2σ²) - ||w||²/(2τ²)). Maximising that posterior is equivalent to minimising ||y-Xw||² + (σ²/τ²)||w||², which is L2-regularised linear regression with λ = σ²/τ² (up to the 1/n convention). MAP differs materially from MLE when data are scarce, parameters are many relative to n, XᵀX is ill-conditioned, or the prior is informative; as n grows the likelihood dominates and the two estimates converge under regularity conditions. Neither MLE nor MAP gives full uncertainty by itself—they are point estimates—whereas a posterior predictive integrates over the posterior to represent predictive uncertainty.

Corrected by an independent AI reviewer.

What a strong answer covers

  • MLE: argmax p(data|θ). MAP: argmax p(data|θ)p(θ).
  • Gaussian likelihood + Gaussian prior gives squared loss + λ‖w‖² with λ = σ²/τ².
  • MAP matters with small data or many parameters; the two converge as n grows.
  • Neither gives full uncertainty (contrast with a posterior predictive).

Common mistakes

  • calling MAP “fully Bayesian”
  • mixing up the prior variance and λ direction.