HomeStatisticsNo-U-Turn Sampler: 2D Contour, Phase-Space & Energy View

No-U-Turn Sampler: 2D Contour, Phase-Space and Energy View

Watch the No-U-Turn Sampler draw from a curved Bayesian posterior on a 2D contour map: drag to pan, scroll to zoom, and watch linked phase-space and energy-conservation panels update live as the leapfrog tree doubles.

Statistics2DAdvanced60 FPS📱 Mobile-adapted⇄ 3D version
2d-ds-topic-83 ↗ Open standalone

The No-U-Turn Sampler (NUTS) is the algorithm quietly doing the heavy lifting inside Stan, PyMC and NumPyro every time a real Bayesian model gets fit. This 2D companion runs the exact same NUTS mechanism — momentum resampling, binary-tree leapfrog doubling, the no-U-turn stopping rule (θ⁺−θ⁻)·r ≥ 0 — but visualises it the way statisticians actually read diagnostics: a pannable/zoomable top-down contour map of the curved "banana" posterior with live marginal histograms along its edges, a momentum phase-space portrait, and a Hamiltonian energy trace that reveals numerical divergence directly instead of hiding it behind a 3D orbit camera. Adjust the step size and maximum tree depth, run Auto-Sample, and watch the accumulated draws and marginal histograms converge onto the posterior's true bent shape.

⚙ Under the hood

Watch the No-U-Turn Sampler draw from a curved Bayesian posterior on a pannable, zoomable 2D contour map: the same leapfrog trajectory-doubling algorithm as the 3D version, but read the way statisticians actually diagnose it — live marginal histograms along the map's edges, a momentum phase-space portrait, and a Hamiltonian energy trace that exposes numerical divergence directly.

bayesianmcmcnutshamiltonian-monte-carlostatisticssampling2d

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)