NSState¶
- class jaxrens.state.ns.NSState(population, log_evidence, iteration, emax, rng_key, n_walkers=0, n_atoms=0)[source]¶
Bases:
objectAlgorithm-only state of a nested sampling run.
Ensemble-agnostic: MCState.energy is the full potential (U, H, Ω, …), computed by the backend (possibly including an EnsembleTerm).
Shape annotations use a variadic batch prefix
*Bto cover all three BatchDescriptor topologies: SingleRun (*B = ()), VmapRuns (*B = (n_runs,)), and PmapVmapRuns (*B = (G, P)).- Variables:
population (Any) – Batched MCState with shape
(*B, n_walkers, ...)on every field. TypedAnybecauseMCStateis generated by a factory instate/mc_state.pyand not statically named.log_evidence (jaxtyping.Float[jaxlib._jax.Array, '*B']) – Running log-evidence estimate, shape
(*B,).iteration (jaxtyping.Int[jaxlib._jax.Array, '*B']) – Current iteration count, shape
(*B,). Used inside JIT for the prior-mass weight in log_evidence accumulation.emax (jaxtyping.Float[jaxlib._jax.Array, '*B']) – Per-replica NS contour, shape
(*B,)— the constraint level the most recently completedns_stepculled at. Algorithm state, NOT a derived quantity: it is set byns_step(andns_step_sharded) at cull time and read verbatim byadapt_stepand replica-exchange, neither of which re-derive it frompopulation.energy. This separation matters becausepopulation.energyis just empirical samples from the likelihood-restricted prior parameterised byemax; collapsing the two viamax(pop.energy)conflates the distribution’s defining parameter with a sample statistic and lets post-MCMC noise (or future pop-mutators) silently shift the contour. Init value is+inf(no contour enforced yet — the firstns_stepdefinesL_0).rng_key (jaxtyping.Key[jaxlib._jax.Array, '*B']) – JAX PRNG key array, shape
(*B,).n_walkers (int) – Number of live walkers (compile-time constant).
n_atoms (int) – Number of atoms (compile-time constant).
- Parameters: