elisa.infer.samplers.ensemble.base#
- class EnsembleSamplerState(coords: NDArray[float], random_state: Any)[source]#
Bases:
NamedTupleEnsemble sampler state.
Methods
count(value, /)Return number of occurrences of value.
index(value[, start, stop])Return first index of value.
- class EnsembleSampler(numpyro_model: Callable, init_params: dict[str, float] | None = None, ignore_nan: bool = False, seed: int = 42, model_args: tuple = (), model_kwargs: dict | None = None)[source]#
Bases:
objectMethods
get_random_state(seed)Get the random state for the sampler.
get_sampling_fn(chains, warmup, steps, ...)Generate the sampling function.
run([warmup, steps, chains, thinning, ...])Run the sampler.
- run(warmup: int = 5000, steps: int = 5000, chains: int | None = None, thinning: int = 1, n_parallel: int = 4, tune: bool | None = None, progress: bool = True, states: Sequence[EnsembleSamplerState] | None = None, warmup_kwargs: dict | None = None, sampling_kwargs: dict | None = None) tuple[dict[str, ndarray[tuple[Any, ...], dtype[float]]], tuple[EnsembleSamplerState, ...]][source]#
Run the sampler.
- Parameters:
- warmup
int, optional The warmup (burn-in) steps. The default is 5000.
- steps
int, optional The sampling steps. The default is 5000.
- chains
int, optional The number of walkers. The default is 4 * ndim.
- thinning
int Stores every thinning samples in the chain. When this is set, steps * thinning proposals will be made. The default is 1.
- n_parallel
int, optional Number of parallel samplers. The default is 4.
- tunebool, optional
Whether to tune the parameters of moves. Defaults to the corresponding sampler’s default.
- progressbool, optional
Whether to display a progress bar. The default is True.
- statessequence, optional
The initial states of the samplers.
- warmup_kwargs: dict, optional
Extra parameters passed to sampler constructor for warm-up phase.
- sampling_kwargs: dict | None = None,
Extra parameters passed to sampler constructor for sampling phase.
- warmup
- Returns:
- abstractmethod get_sampling_fn(chains: int, warmup: int, steps: int, thinning: int, tune: bool | None, warmup_kwargs: dict, sampling_kwargs: dict) Callable[[int, EnsembleSamplerState, Queue], tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], EnsembleSamplerState]][source]#
Generate the sampling function.