This Probability concept is the current idea: keep the same invariant visible across Intuition, Math, Code, Interactive Demo.
Probability
Bayesian Updating and Conjugacy
Conjugacy makes Bayesian updating algebraic: compatible likelihood sufficient statistics add to prior hyperparameters, yielding a same-family posterior.
Concept Structure
Bayesian Updating and Conjugacy
Start with the picture, metaphor, or geometric mechanism.
Make the objects explicit and connect them with notation.
Mirror the equations with runnable implementation details.
Manipulate the mechanism and watch the idea respond.
Learner Contract
What this page should let you do.
3 prerequisites listed; refresh them before leaning on the math or code.
Explain the mechanism, trace the main notation, and test one prediction in the live demo.
Read the intuition before the notation; the math should name a mechanism you already felt.
Follow this edge after making one prediction here; the next page should reuse the result, not restart the route.
Claim/source review status
Substantive review recorded
1/1 claims have bounded review metadata; still check caveats and source scope.Metadata-derived; review may be AI-assisted. Not a human certification.01
Intuition
Build the mental picture first so the rest of the page has something to attach to.
Bayesian updating has one basic move:
Conjugacy is what happens when that multiplication is kind. The prior and posterior stay in the same distribution family, and the data changes only a small set of hyperparameters.
For a Bernoulli coin, a beta prior keeps two numbers: how much mass leans toward heads and how much mass leans toward tails. After seeing heads and tails, the posterior is another beta distribution. The update is not a new optimization problem:
That is the first mental model. A conjugate prior is a ledger that knows which sufficient statistics the likelihood will contribute.
The deeper pattern is not "memorize the beta table." In exponential-family models, likelihood terms contain sufficient statistics such as counts, sums, or squared sums. A conjugate prior stores compatible natural parameters. Bayesian updating adds the data's sufficient statistics into that ledger and then renormalizes.
This is why conjugacy is so useful in probabilistic modeling. It gives exact posterior updates, exact posterior predictive probabilities, and often analytic marginal likelihoods. It is also why conjugacy is limited. If the model or prior no longer matches this algebra, Bayesian inference does not disappear; it usually becomes approximate inference, such as Monte Carlo or variational inference.
02
Math
Translate the story into symbols, assumptions, and a derivation you can inspect.
Let be an unknown parameter and be observed data. Bayes' rule gives
A prior family is conjugate to a likelihood family when the posterior stays in for every dataset in the model:
The easiest exact example is the beta-Bernoulli model. Let be the probability of success. The prior is
If the data has successes and failures, the Bernoulli likelihood has shape
Multiplying likelihood and prior gives
so
The posterior predictive probability of the next success is the posterior mean:
For a -class categorical model, let be class probabilities and let the prior be
If is the count of class , the likelihood contributes
The posterior is
and the posterior predictive probability for class is
For a normal mean with known observation variance, the sufficient statistic is different. Let
with known , and let the prior be
where is prior precision. If is the sample mean, the data precision is
The posterior is another normal distribution,
with
and
So the update is still ledger arithmetic, but the ledger is precision-weighted rather than count-only.
The general exponential-family version explains why this keeps happening. Suppose the likelihood can be written as
where is a natural parameter, is a sufficient statistic, and is the log normalizer. A conjugate prior often has the form
For iid data, the likelihood contributes and . The posterior hyperparameters become
This is the reusable invariant: conjugacy works when the prior is shaped to receive the likelihood's sufficient statistics.
03
Code
Keep the implementation aligned with the notation so the algorithm is legible.
import numpy as np
def beta_bernoulli(alpha, beta, heads, tails):
post = np.array([alpha + heads, beta + tails], dtype=float)
return post, post[0] / post.sum()
def dirichlet_categorical(alpha, counts):
post = np.asarray(alpha, dtype=float) + np.asarray(counts, dtype=float)
return post, post / post.sum()
def normal_known_variance(mu0, prior_var, xbar, n, obs_var):
prior_precision = 1.0 / prior_var
data_precision = n / obs_var
post_precision = prior_precision + data_precision
post_mean = (prior_precision * mu0 + data_precision * xbar) / post_precision
return post_mean, 1.0 / post_precision
print("Beta posterior:", beta_bernoulli(2, 3, heads=5, tails=3))
print("Dirichlet posterior:", dirichlet_categorical([1, 1, 1], [3, 4, 1]))
print("Normal posterior:", normal_known_variance(-1.0, 1.0, 0.625, 8, 1.0))
Each function mirrors the same idea. The posterior is not found by maximizing the likelihood. It is found by adding the likelihood's sufficient statistics to prior hyperparameters and then reading the updated distribution.
04
Interactive Demo
Use direct manipulation to connect the explanation to a moving system.
The Conjugacy Ledger Lab hides the posterior ledger until you commit to an update rule.
Switch among three conjugate pairs:
- Beta-Bernoulli: prior shape parameters plus success/failure counts.
- Dirichlet-categorical: prior class mass plus category counts.
- Normal-normal with known variance: prior precision plus data precision.
Before revealing, decide whether the posterior should add sufficient statistics, replace the prior with the MLE, directly average parameters, or remain unchanged. Then reveal the exact posterior and the posterior predictive summary.
Live Concept Demo
Explore Bayesian Updating and Conjugacy
The stage is code-native and interactive. Use it to test the explanation against the mechanism.
Manipulate one control and predict the visible change.
Commit to what Bayesian Updating and Conjugacy should make visible before reading the result.
After The First Pass
Turn the concept into an inspected object.
Once the invariant is visible in the intuition, math, code, and demo, use these panels to inspect the mechanism visually, check source support, practice the idea, and attach a grounded research question.
Mechanism Storyboard
See the idea move before the page explains it
Conjugacy makes Bayesian updating algebraic: compatible likelihood sufficient statistics add to prior hyperparameters, yielding a same-family posterior.
Start with the picture, metaphor, or geometric mechanism.
Before reading further, choose the kind of change Bayesian Updating and Conjugacy should make visible.
Visual Inquiry
Make the image answer a mathematical question
Conjugacy makes Bayesian updating algebraic: compatible likelihood sufficient statistics add to prior hyperparameters, yielding a same-family posterior.
Which visible object should carry the first intuition?
Pick the cue that should make Bayesian Updating and Conjugacy easier to reason about before the page gives the answer.
Source Grounding
Canonical references for the mechanism on this page.
Grounds the conjugate-prior definition, beta-binomial/Beta-Bernoulli update, normal-normal known-variance update, and the warning that nonconjugate cases may require computational methods.
Open sourceGrounds Bayes' rule, conditional probability, distributions, and the probability notation used by the update algebra.
Open sourceProbabilistic-ML reference for Bayesian parameter learning, conjugate examples, posterior predictive reasoning, and the bridge to approximate inference.
Open sourceSupports the exponential-family conjugacy pattern: prior natural parameters update by adding sufficient statistics and sample count terms.
Open sourceClaim Review
Conjugacy makes Bayesian updating algebraic: compatible likelihood sufficient statistics add to prior hyperparameters, yielding a same-family posterior.
Claims without a substantive review badge still need exact source-support review.
mit-18-05-conjugate-priors, deisenroth-2020-mml, murphy-2022-probabilistic-ml, jordan-2010-conjugate-priors
Use equations, runnable code, and demos to check whether the source support is operational.
The sources support conjugacy as posterior-family closure, the Beta-Bernoulli/count-addition witness, the Dirichlet-categorical count-addition pattern through exponential-family sufficient statistics, the normal-normal known-variance precision update, and the caveat that conjugacy is a convenience rather than a universal Bayesian method.
Sources: MIT 18.05 Lecture 15: Bayesian Updating with Discrete Priors, Mathematics for Machine Learning, Probabilistic Machine Learning: An Introduction, Berkeley CS 281B / Stat 241B Lecture 4: Exponential Families and Conjugate PriorsFinite and known-variance witnesses only; excludes hierarchical priors, unknown-variance normal-inverse-gamma updates, nonparametric Bayes, improper-prior edge cases, and a GPT Pro publication pass.A bounded review summary is present; still check caveats and exact reference scope.Checked MIT 18.05 for the conjugate-prior definition, beta-binomial/Beta-Bernoulli and normal-normal known-variance updates, and the nonconjugate warning; checked MML for Bayes-rule and distribution notation; checked Murphy's ProbML context for Bayesian parameter learning and posterior predictive use; checked Jordan's exponential-family lecture for the natural-parameter plus sufficient-statistics conjugacy form. GPT Pro publication critique remains pending.
Reviewer: codex-local-source-review; reviewed 2026-07-02Source support candidates
course-notes 2022MIT 18.05 Lecture 15: Bayesian Updating with Discrete PriorsGrounds the conjugate-prior definition, beta-binomial/Beta-Bernoulli update, normal-normal known-variance update, and the warning that nonconjugate cases may require computational methods.
book 2020Mathematics for Machine LearningGrounds Bayes' rule, conditional probability, distributions, and the probability notation used by the update algebra.
book 2022Probabilistic Machine Learning: An IntroductionProbabilistic-ML reference for Bayesian parameter learning, conjugate examples, posterior predictive reasoning, and the bridge to approximate inference.
course-notes 2010Berkeley CS 281B / Stat 241B Lecture 4: Exponential Families and Conjugate PriorsSupports the exponential-family conjugacy pattern: prior natural parameters update by adding sufficient statistics and sample count terms.
Practice Loop
Try the idea before it explains itself
Conjugacy makes Bayesian updating algebraic: compatible likelihood sufficient statistics add to prior hyperparameters, yielding a same-family posterior.
Before touching the demo, predict one visible change that should happen in Bayesian Updating and Conjugacy.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
A concrete answer is on the canvas.
The answer names why the claim should hold.
It touches the page context or a neighboring idea.
Research Room
Attach the question to a claim, equation, code, or demo
Pick the concept, equation, source, runnable code, claim, misconception, or demo state before asking for help. The handoff keeps that page item in context.Open the draft below to save one note and next action in this browser.
Bayesian Updating and Conjugacy
What is the smallest example that makes Bayesian Updating and Conjugacy click without losing the math?
Local action draftNo local draft saved yetExpand only when ready to capture one local next action
This draft stays in this browser, attached to the selected learning item.
- References to inspect: attached references on this page.
- Definition, prerequisite, and contrast concept links
- The equation or runnable code that makes the concept operational
- One demo state that shows the invariant instead of a slogan
- The learner can state the mechanism in their own words
- The learner can name the prerequisite that would repair confusion
- The learner can predict how the mechanism changes under one perturbation
I am working in Continuous Function's research reading room. Object: concept - Bayesian Updating and Conjugacy Selected item key: recorded for copy. Context: Probability Page anchor: recorded for copy. Open question: What is the smallest example that makes Bayesian Updating and Conjugacy click without losing the math? Evidence to inspect: - References to inspect: attached references on this page. - Definition, prerequisite, and contrast concept links - The equation or runnable code that makes the concept operational - One demo state that shows the invariant instead of a slogan What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action.
concept/concept-notebook/probability/bayesian-updating-conjugacy
concept:probability/bayesian-updating-conjugacy