Let's build this from scratch using Bayes' theorem:
Step 1: Start with Bayes' rule for the posterior
P(θ∣x)=P(x)P(x∣θ)⋅P(θ)
Why this form? We want to "flip" from P(x∣θ) (the likelihood) to P(θ∣x) (the posterior). Bayes' theorem is the mathematical machinery for this inversion.
Step 2: Find the θ that maximizes the posterior
θ^MAP=argmaxθP(θ∣x)=argmaxθP(x)P(x∣θ)⋅P(θ)
Why this step? We're looking for the peak of the posterior distribution—the single most likely parameter value.
Step 3: Drop the denominator (it's constant w.r.t. θ)
θ^MAP=argmaxθP(x∣θ)⋅P(θ)
Why can we drop it?P(x) is the marginal likelihood (evidence), which doesn't depend on θ. Since we're optimizing over θ, constants don't affect the argmax location.
Step 4: Take logarithm for computational convenience
θ^MAP=argmaxθ[logP(x∣θ)+logP(θ)]
Why log? Products become sums (easier to optimize), and log is monotonic so it preserves argmax. This is the standard log-posterior.
Maximum Likelihood Estimation (MLE) is a special case of MAP:
θ^MLE=argmaxθP(x∣θ)=argmaxθlogP(x∣θ)
Derivation: If we use a uniform prior P(θ)=const, then:
θ^MAP=argmaxθ[logP(x∣θ)+log(const)]=argmaxθlogP(x∣θ)=θ^MLE
Why? A uniform prior means "all parameter values are equally likely before seeing data." The prior contributes nothing to the optimization, so we're back to pure likelihood maximization.
Key insight: MAP generalizes MLE by allowing non-uniform priors. MLE is MAP with no prior knowledge.
Why this is powerful: Every regularization scheme can be interpreted as a prior belief about parameters. Choosing regularization = choosing a prior.
Recall Explain Like I'm 12
Imagine you're trying to guess how many candies are in a jar. Your friend says "I counted 47 candies through the glass" (this is your data). But you also know that the jar usually holds about 50 candies when it's full (this is your prior knowledge).
MLE would say: "Trust the count completely—guess 47."
MAP would say: "The count is probably close, but the jar is usually around 50, so maybe the count was off by a bit. I'll guess 48 or 49—something between what I saw and what I expected."
MAP combines what you see (the data) with what you already know (the prior). It's like asking two experts and finding a smart compromise between them. The more confident each expert is, the more you listen to them. If you've seen 1000 candies clearly, you trust the data more. If you only glimpsed a few, you trust your prior knowledge more.
Conjugate Priors — Make MAP computationally tractable
Regularization in ML — Equivalent to MAP with specific priors
Beta Distribution — Common prior for probabilities
Posterior Distribution — MAP finds its mode
Overfitting — MAP prevents this better than MLE with small data
Fisher Information — Used in Jeffreys prior for reparameterization invariance
Ridge Regression — MAP with Gaussian prior on coefficients
Lasso Regression — MAP with Laplace prior on coefficients
#flashcards/ai-ml
What is the MAP estimation formula in terms of log-posterior? :: θ^MAP=argmaxθ[logP(x∣θ)+logP(θ)] — sum of log-likelihood and log-prior
How does MAP relate to MLE? :: MLE is MAP with a uniform prior: when P(θ)=const, the prior term vanishes and MAP reduces to MLE
In MAP estimation, why can we drop P(x) from Bayes' theorem?
Because P(x) doesn't depend on θ—it's a constant w.r.t. the optimization variable, so it doesn't affect the argmax
For coin flips with k heads in n flips and Beta(α, β) prior, what is the posterior?
Beta(α+k, β+n−k) — add observed heads to α, observed tails to β
What is the mode of a Beta(α, β) distribution?
α+β−2α−1 for α,β>1 — found by setting derivative of log-PDF to zero
What type of regularization corresponds to a Gaussian prior in MAP?
L2 regularization — Gaussian prior N(0,σ2) gives regularization term 2σ2∥θ∥2
What type of regularization corresponds to a Laplace prior in MAP?
L1 regularization — Laplace prior gives regularization term λ∥θ∥1
Does MAP give the mean or mode of the posterior?
Mode — MAP finds the parameter value with highest posterior probability, not the average
What happens to MAP estimate as sample size approaches infinity?
MAP converges to MLE — the data term grows with n while prior term stays constant, so prior influence vanishes
For Gaussian data with Gaussian prior, is MAP estimate closer to sample mean or prior mean?
A weighted average — specifically μ^MAP=nσ02+σ2nσ02xˉ+nσ02+σ2σ2μ0
Why is Beta distribution a conjugate prior for binomial likelihood?
Because Beta prior × Binomial likelihood = Beta posterior — the posterior stays in the same family, making computation analytical
What is the relationship between negative log-posterior and regularized loss?
They are equivalent: −logP(θ∣x)=data loss+regularization term
If you use MAP with Beta(1,1) prior for coin bias, what estimate do you get?
Exactly the MLE — Beta(1,1) is uniform on [0,1], equivalent to no prior information
What is Jeffreys prior and why use it?
P(θ)∝∣I(θ)∣ where I is Fisher information — it's invariant under reparameterization, making it a truly non-informative prior
For Gaussian mean estimation, how does prior variance σ02 affect MAP? :: Larger σ02 means less confident prior, so MAP relies more on data and approaches MLE; smaller σ02 pulls estimate toward prior mean
Dekho, jab bhi hum kisi parameter ka estimate karna chahte hain (jaise coin ke bias ya kisi distribution ka mean), toh humein do chezein consider karni padti hain: pehli, jo data humein dikha raha hai (likelihood), aur dosri, jo hum pehle se jante the (prior belief). Maximum Likelihood (MLE) sirf data ko dekhta hai, lekin MAP dono ko balance karta hai — ye Bayesian approach hai.
Samjho ek example se: tumhare pas ek coin hai aur tum 10 baar flip karte ho, 7 baar heads ata hai. MLE kehta hai bias = 7/10 = 0.7. Lekin agar tumhe pehle se pata tha ki ye coin thoda biased hai (prior knowledge), toh MAP us information ko bhi use karega. Agar prior kehta hai "I think bias 0.6 ke as-paas hoga", toh MAP final estimate ko thoda 0.6 ki taraf pull karega — result ayega around 0.69. Jaise jaise zyada data milta hai (100 flips