Probabilistic & Bayesian ML

conjugate prior

/ KON-juh-git PRY-or /

A conjugate prior is a lucky mathematical match: a prior whose shape, after you fold in the data, comes back out as the same shape — just with updated numbers. It is like having a savings account where every deposit keeps the balance in the same currency. You never have to convert; updating is as simple as adjusting a couple of counters.

Concretely, if your prior belief about a coin's bias is a Beta distribution and you observe coin flips (a Binomial process), the posterior is again a Beta distribution. To update, you just add the number of heads to one parameter and the number of tails to the other. No integrals, no sampling — the Bayesian update collapses into arithmetic. Famous pairs include Beta with Binomial, Gamma with Poisson, and a Gaussian prior with a Gaussian likelihood.

Why it matters, and where it stops: in the era before fast computers, conjugacy was often the only way to do Bayesian inference at all, and it is still prized for being exact, instant, and easy to reason about. But it is a convenience, not a law of nature. Real problems rarely hand you a conjugate model, and forcing one can distort your honest beliefs. When no conjugate prior fits, you fall back on approximate methods like MCMC or variational inference. Treat conjugacy as a gift when it appears, not a requirement to chase.

A website's click-through rate. Start with a Beta(1,1) prior (flat, totally unsure). Show the ad 200 times; it's clicked 30 times. The posterior is simply Beta(1+30, 1+170) = Beta(31, 171). Done — no computation harder than adding. Its mean is 31/202 ≈ 15%, and the distribution's width honestly reflects that 200 trials is still a modest sample.

Beta–Binomial conjugacy: updating is just adding successes and failures to the two prior counts.

Conjugacy is chosen for mathematical convenience, not because it captures the truth. If your real beliefs aren't shaped like the conjugate family, picking it anyway trades honesty for tidiness. Modern computation means you are no longer forced to make that trade.

Also called
conjugacy共轭先验共軛先驗共轭分布