See, with pictures and motion, two ways to handle a hard-to-handle shape (a distribution): copying it with footprints, and tracing it with a bell.
This page checks two methods that work without knowing the normalization constant Z = ∫ p̃(x) dx, using a one-dimensional target distribution. In Tab ①, the Laplace approximation and the Gaussians that minimize the KL divergence in its two directions are overlaid, so that you can see which way each approximation is distorted and check numerically that the ELBO is a lower bound on ln Z whose gap is KL(q‖p). In Tab ②, you run Metropolis–Hastings chains and read the proposal width, acceptance rate, autocorrelation, effective sample size, and R̂, and you confirm that for a double well with a high barrier the chains “look settled yet have not converged.”
A traveler walks over the hills by a fixed rule and leaves footprints. See whether the pile of footprints gets close to the target shape.
This is a teaching example (the target shape is made from a formula, and the traveler’s steps are decided by random numbers).
Trace a shape with two humps using a single bell shape. Compare the results of two ways of tracing: “Don’t spill over” and “Don’t miss any.”
This is a teaching example (the shape to trace is made from a formula).
Target p(x) and three Gaussian approximations
The figure shows the Laplace approximation (second-order expansion at the mode), the q that minimizes KL(q‖p), and the q that minimizes KL(p‖q) (matching the mean and variance).
The horizontal axis is in nats (the unit of the natural logarithm). The vertical solid line is ln Z (numerical integration on a grid). The length of the hatched band from the ELBO (●) of each q to ln Z is KL(q‖p). For every q, ELBO ≤ ln Z. For a Beta target, the ELBO and KL(q‖p) are computed with q truncated to 0 < x < 1 and renormalized.
Histogram of the samples and the true density
A histogram of the pooled samples from all chains after burn-in (the initial samples that are discarded).
Trace plot (x versus step for each chain)
Autocorrelation function ρk
The horizontal axis is the lag k (steps) and the vertical axis is ρk (dimensionless). It is computed for each chain from the samples after burn-in. The mark on each chain’s line is the truncation point kc of the integrated autocorrelation time (Sokal’s automatic window).
The description of this simulator (procedure, formulas, conditions, questions) is on the explanation page “Explanation of the Approximate Inference and MCMC Simulator”.
Back to Machine Learning — From Probability to GPT (Contents) | Text: Chapter 20, Section 20.2, Chapter 21, Section 21.6 | Equations and explanation (explanation page) | Equations are typeset with the browser’s built-in MathML (no external library).