elisa.infer.samplers.util#
- class ModelInfo(ndim: int, init: dict[str, NDArray[floating]], init_ravel: NDArray[floating], unravel: Callable[[NDArray[floating]], dict[str, NDArray[floating]]], log_prob_fn: Callable[[dict[str, NDArray[floating]]], float], postprocess_fn: Callable[[dict[str, NDArray[floating]]], dict[str, NDArray[floating]]], params_names: list[str], params_dtype: list[tuple[str, dtype, tuple[int, ...]]], deterministic_names: list[str], deterministic_dtype: list[tuple[str, dtype, tuple[int, ...]]])[source]#
Bases:
NamedTupleModel information.
Methods
count(value, /)Return number of occurrences of value.
index(value[, start, stop])Return first index of value.
- ndim: int#
Model dimension.
- init: dict[str, NDArray[floating]]#
Initial parameters values in unconstrained space.
- init_ravel: NDArray[floating]#
Raveled initial parameters values in unconstrained space.
- unravel: Callable[[NDArray[floating]], dict[str, NDArray[floating]]]#
Function to unravel parameters values.
- log_prob_fn: Callable[[dict[str, NDArray[floating]]], float]#
Log probability function given parameters in unconstrained space.
- postprocess_fn: Callable[[dict[str, NDArray[floating]]], dict[str, NDArray[floating]]]#
Postprocess function given parameters in unconstrained space.
- params_names: list[str]#
Names of parameters.
- params_dtype: list[tuple[str, dtype, tuple[int, ...]]]#
NumPy dtypes of parameters in constrained space.
- deterministic_names: list[str]#
Names of deterministic sites.
- deterministic_dtype: list[tuple[str, dtype, tuple[int, ...]]]#
NumPy dtypes of deterministic sites.
- get_model_info(model: Callable, init_strategy: Callable = <function init_to_uniform>, model_args: tuple = (), model_kwargs: dict | None = None, forward_mode_differentiation: bool = False, validate_grad: bool = True, rng_seed: int = 42) ModelInfo[source]#
Get model information.
- class UniformReparam[source]#
Bases:
ReparamReparameterize a distribution to a Uniform over the unit hypercube.
Most univariate distribution uses inverse CDF for reparameterization.
Methods
__call__(name, fn, obs)
- uniform_reparam_transform(d)[source]#
A helper for
UniformReparamto get the transform that maps a uniform distribution over a unit hypercube to the target distribution d.