Back

MCMC sampler comparator

What you are seeing: three different random-walk algorithms trying to sample from the same probability density π(x,y)\pi(x, y). The grey shading on the left is the density itself (darker = higher probability). Each colored trail is one sampler laying down points: it tries to walk in a way that, in the long run, spends time at each (x,y)(x, y) in proportion to π\pi.

A "good" sampler explores the whole region quickly and decorrelates; a "bad" sampler gets stuck. The right panels are live trace plots of the xx coordinate of each chain, plus its acceptance rate and effective sample size NeffN_\text{eff}. Switch the target to the banana or the funnel to see HMC pull ahead; switch to the mixture to see samplers getting trapped in one mode.

Figure 1. Three MCMC samplers running simultaneously on a 2D target. Method: shared/js/engine/mcmc-harness.js; ESS via the initial monotone sequence estimator from shared/js/invariants/ess.js.
Target
Sampler A
Sampler B
Sampler C
HMC L
Sample N

WHAT TO TRY

  • Vary each control and watch the rail readouts respond.
  • Compare the diagnostic plot against the live scene.