Interactive demo · Bayesian and Probabilistic Machine Learning · Chapter 10

Gaussian approximations: Laplace, KL(q‖p) and KL(p‖q)

Three ways to replace a distribution p by a simpler q. The Laplace approximation fits a Gaussian to the curvature at the mode. Variational inference minimises KL(q‖p), which punishes q for putting mass where p has little: q is compact and seeks a mode. Moment matching minimises KL(p‖q), which punishes q for missing mass of p: q is broad and covers everything (this is the step used by expectation propagation). See it on a skewed density (A), a correlated Gaussian with a factorised q (B) and a density with two modes (C).

Example

Scale

p(z) ∝ exp(−z²/2) σ(az + b): slope a

Shift b

Correlation ρ of p

Factorised q minimises

Coordinate ascent (10.13), (10.15)

Separation of the two modes

Gaussian q minimises

Start of the optimisation (or click the plot)

Scoreboard

Try these

Expectations under q use a 61-point (61 × 61 in two dimensions) Gaussian grid rule, the same rule as the Python code; KL(q‖p) is minimised by quasi-Newton steps (BFGS). In example A, moment matching is exactly what one EP update does when p has a single non-Gaussian factor.

In the lecture notes