Hamiltonian Monte Carlo: Leapfrog Sampling
Watch Hamiltonian Monte Carlo sample a Bayesian posterior in 3D: a momentum-augmented particle rolls across a probability-density surface via leapfrog integration, with live accept/reject decisions and acceptance-rate tracking.
Fitting a Bayesian model means characterising a posterior distribution that almost never has a closed form — so instead you sample from it. This simulator renders that posterior as a real 3D probability-density surface and runs Hamiltonian Monte Carlo on it exactly as Stan or PyMC would: each proposal samples a random momentum, integrates a physical trajectory across the surface with the leapfrog method, and accepts or rejects it by how well total energy was conserved. Watch the chain glide along a correlated ridge far more efficiently than a naive random walk could, tune the step size and trajectory length to see acceptance rate trade off against exploration, and switch to a bimodal target to see where even a gradient-aware sampler can get stuck in one mode.
Watch Hamiltonian Monte Carlo sample a Bayesian posterior in 3D: a momentum-augmented particle rolls across a probability-density surface via leapfrog integration, with live accept/reject decisions and acceptance-rate tracking.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install