Maximum Likelihood & MAP Estimation

GATE Relevance: Very High

🎯 Learning Objectives

  • Formulate the likelihood function for common distributions
  • Derive MLE for Bernoulli, Gaussian, and Poisson distributions
  • Use the log-likelihood trick to simplify optimization
  • State MAP estimation and its relationship to MLE and priors
  • Compare MLE vs MAP vs full Bayesian inference

1. Maximum Likelihood Estimation

Likelihood Function

Given data D = {x1, …, xn} assumed i.i.d. from a distribution with parameter θ:

L(θ) = P(D | θ) = ∏i=1n P(xi | θ)

The MLE is: θ̂MLE = argmaxθ L(θ)

Log-Likelihood Essential Trick

ℓ(θ) = log L(θ) = ∑i=1n log P(xi | θ)

Since log is monotonically increasing, maximizing log-likelihood gives the same θ̂ as maximizing likelihood, but products become sums — much easier to differentiate.

2. MLE for Common Distributions

Bernoulli Distribution

Example GATE Favorite

Data: n coin flips with k heads. P(xi | p) = pxi(1−p)1−xi

ℓ(p) = k log p + (n−k) log(1−p)

Setting dℓ/dp = k/p − (n−k)/(1−p) = 0:

p̂MLE = k/n

10 flips, 7 heads ⇒ p̂ = 7/10 = 0.7

Normal (Gaussian) Distribution

MLE for Normal

Data: x1, …, xn ~ N(μ, σ2)

μ̂MLE = (1/n) ∑ xi = x̄ (sample mean)
σ̂2MLE = (1/n) ∑ (xi − x̄)2

Note: MLE for variance divides by n (biased), not n−1.

Poisson Distribution

MLE for Poisson GATE Style

P(x|λ) = e−λλx/x!. ℓ(λ) = −nλ + (∑ xi) log λ − ∑ log(xi!)

λ̂MLE = (1/n) ∑ xi = x̄

Data: {2, 3, 1, 4, 2} ⇒ λ̂ = 12/5 = 2.4

3. MAP Estimation

Maximum A Posteriori Estimation

θ̂MAP = argmaxθ P(θ | D) = argmaxθ P(D | θ) P(θ)

MAP incorporates a prior P(θ) over the parameter. In log form:

θ̂MAP = argmaxθ [log P(D|θ) + log P(θ)]

Example — Bernoulli with Beta Prior

Prior: Beta(α, β). Data: k heads in n flips.

p̂MAP = (k + α − 1) / (n + α + β − 2)

With Beta(2,2) prior and 7 heads in 10 flips: p̂MAP = (7+1)/(10+2) = 8/12 ≈ 0.667

Compare with MLE = 0.7. The prior "pulls" the estimate toward 0.5.

MLE vs MAP vs Full Bayesian

MethodFormulaUses Prior?
MLEargmax P(D|θ)No
MAPargmax P(θ|D)Yes (point estimate)
Full BayesianP(θ|D) entire posteriorYes (full distribution)

MLE with Uniform Prior = MAP

If the prior is uniform (flat), then MAP reduces to MLE since log P(θ) is constant.

Summary

  • MLE: maximize likelihood (or log-likelihood) — no prior needed
  • MLE for Bernoulli = sample proportion, for Gaussian = sample mean and (biased) variance
  • MAP: maximize posterior = likelihood × prior — acts as regularization
  • MAP with uniform prior = MLE
  • Log-likelihood converts products to sums — a key computational trick