Interactive demo · Bayesian and Probabilistic Machine Learning · Chapter 11

Slice sampling and Hamiltonian Monte Carlo

Two ways to take large steps without a hand-tuned proposal. Slice sampling draws a height u under the curve and then a point uniformly from the slice {z : p̃(z) > u}, finding the slice by stepping out and shrinking. Hybrid Monte Carlo gives the state a random momentum and follows Hamiltonian dynamics with the leapfrog integrator, which preserves volume and nearly preserves the energy H, so long moves are still accepted.

Method

Initial width w

Run

Step size ε

Number of steps L

Target

Step size ε

Leapfrog steps L

Run

Try these

Slice sampling target: p̃(z) = 0.55 exp(−(z+2)2/(2·0.752)) + 0.45 exp(−(z−2)2/(2·0.952)), the two-bump shape of Figure 11.13. Leapfrog: E(z) = z2/2 from (z, r) = (1, 1). Hybrid Monte Carlo: a Gaussian with standard deviations 1 and 0.1 along the diagonals, or the mixture of N(±(1, 1), 0.52I); each iteration picks the direction of integration at random and jitters ε by up to ±10% (Section 11.5.2). The comparison chain is random-walk Metropolis with ρ = σmin, run for L steps per HMC iteration so both use the same number of density or gradient evaluations.

In the lecture notes