jaxrens.sampling.bucket_manager¶
Neighbor-bucket ladder management shared by the NS loop and burn-in.
Both _run_loop (NS proper) and initial_walk (burn-in) advance MCMC
state in steps that can overflow the per-walker neighbor budget configured
via max_neighbors on the population. When that happens the outer
Python loop has to:
Roll back to the pre-step
ns_state,Grow the bucket to the next ladder entry,
Retry the same step (the JAX cache hands us the kernel compiled for the new bucket, or compiles it once on first hit).
Optionally — when shrink_dwell > 0 — the loop also tracks how long the
observed neighbor peak has stayed below the next-smaller ladder entry
(modulo the offset headroom) and steps the bucket back down once the dwell
is satisfied. Temporal hysteresis via shrink_dwell and the offset
slack already keep the bucket from thrashing at a boundary; no extra
shrink-side margin is needed on top.
Both pickers (_pick_next_bucket / _pick_prev_bucket) and the
BucketManager orchestrator live here; the two outer loops own only the
Python control flow that decides when to call them.
Classes
Outer-loop helper that owns |