/ proof-of-concept / walnuts-interactive
Sign in
proof-of-concept / walnuts-interactive
walnuts-interactive / README.md
2.5 KBPreviewCodeBlameHistoryRaw

Interactive WALNUTS sampling#

Runs in the browser via numbl — no install.

▶ Open walnuts_demo.m and click Run#

Samples are drawn from a 2D "banana" target by WALNUTS (the within-orbit adaptive leapfrog No-U-Turn Sampler). The figure shows the target density as a heatmap with the samples scattered on top.

WALNUTS is a NUTS variant that adapts the leapfrog step size within each orbit: each macro-step halves the step (and doubles the count) until the energy error is within tolerance, then grows the orbit by NUTS-style doubling until a U-turn.

Controls:

How it works#

The script sends the density grid + samples via uihtml(..., 'Data', ...). The controls call back: sendToMATLAB('resample', {n, dt, maxError}) re-runs the chain, and sendToMATLAB('movie', {dt, maxError}) records a few transitions' orbit trajectories (walnuts(..., record=true)); the script replies with sendEventToHTMLSource.

Credits#

Deploy#

Pushing to main builds the app and publishes the project to GitHub Pages via the deploy workflow.

↑↓ move↵openescclose