NSState

class jaxrens.state.ns.NSState(population, log_evidence, iteration, emax, rng_key, n_walkers=0, n_atoms=0)[source]

Bases: object

Algorithm-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 *B to 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. Typed Any because MCState is generated by a factory in state/mc_state.py and 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 completed ns_step culled at. Algorithm state, NOT a derived quantity: it is set by ns_step (and ns_step_sharded) at cull time and read verbatim by adapt_step and replica-exchange, neither of which re-derive it from population.energy. This separation matters because population.energy is just empirical samples from the likelihood-restricted prior parameterised by emax; collapsing the two via max(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 first ns_step defines L_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:
  • population (Any)

  • log_evidence (Float[jaxlib._jax.Array, '*B'])

  • iteration (Int[jaxlib._jax.Array, '*B'])

  • emax (Float[jaxlib._jax.Array, '*B'])

  • rng_key (Key[jaxlib._jax.Array, '*B'])

  • n_walkers (int)

  • n_atoms (int)