Each time you toss a coin or weigh something on a scale, see with pictures and motion how your guess of “how much is it really?” changes.
For a success rate μ or a mean μ, check how the knowledge held before seeing data (the prior) changes each time one observation is added (the posterior). Compare formulas and numbers to confirm the difference among maximum likelihood, MAP estimation, and the posterior mean; that the influence of the prior fades as data accumulate; that updating one observation at a time gives the same result as updating all at once; and that the predictive uncertainty has two components.
Each time you toss the coin, the hill of guesses for “the chance of heads is about this much” is redrawn. Toss a few times and watch the hill move and get narrower.
These are synthetic data for teaching purposes (the true chance of heads is set for each coin and can be seen with “Check the answer”).
You weigh one apple many times on a scale whose reading wobbles a little. Each time you weigh, the hill of guesses for “the true weight is about this much” gets narrower.
These are synthetic data for teaching purposes (the apple weights and the scale readings are made up).
Prior, likelihood, and posterior of the success rate μ
Each time you press an observation button, the posterior Beta(μ | a+m, b+l) is redrawn.
The likelihood p(𝒟 | μ) = μm(1 − μ)l is not a probability density of μ. To compare its shape with the prior and posterior, it is shown normalized to area 1 (the same shape as Beta(μ | m+1, l+1)). The shaded range is the 95 % equal-tailed credible interval of the posterior.
The horizontal axis is the number of observations N. The curves show how the posterior mean, the 95 % credible interval, and the maximum-likelihood estimate m/N change after the first N observations. The value at N = 0 is the prior itself.
Prior, likelihood, and posterior of the mean μ, and the predictive distribution of the next observation
The noise standard deviation σ is assumed known. As observations are added, the posterior 𝒩(μ | μN, σN2) becomes narrower.
The likelihood is shown normalized to area 1, with the same shape as 𝒩(μ | x̄, σ2/N). The posterior predictive distribution is the distribution of the “next observation x,” so read its horizontal axis as x (for the other curves the horizontal axis is μ). The × marks at the bottom are the observations (up to the newest 300).
The two components of the predictive variance σ2 + σN2 are drawn as functions of the number of observations N. Only σN2, which comes from lack of knowledge, decreases as data are added; the noise term σ2 does not.
The description of this simulator (procedure, formulas, conditions, questions) is on the explanation page “Explanation of the Bayesian Update Simulator”.
Back to Machine Learning — From Probability to GPT (Contents) | Text: Chapter 4, Section 4.4 | Equations and explanation (explanation page) | Equations are typeset with the browser’s built-in MathML (no external library).