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.
- init: dict[str, ndarray[tuple[Any, ...], dtype[floating]]]#
Initial parameters values in unconstrained space.
- init_ravel: ndarray[tuple[Any, ...], dtype[floating]]#
Raveled initial parameters values in unconstrained space.
- unravel: Callable[[ndarray[tuple[Any, ...], dtype[floating]]], dict[str, ndarray[tuple[Any, ...], dtype[floating]]]]#
Function to unravel parameters values.
- log_prob_fn: Callable[[dict[str, ndarray[tuple[Any, ...], dtype[floating]]]], float]#
Log probability function given parameters in unconstrained space.
- postprocess_fn: Callable[[dict[str, ndarray[tuple[Any, ...], dtype[floating]]]], dict[str, ndarray[tuple[Any, ...], dtype[floating]]]]#
Postprocess function given parameters in unconstrained space.
- 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]#
- uniform_reparam_transform(d: MultivariateNormal)
- uniform_reparam_transform(d: BernoulliProbs)
- uniform_reparam_transform(d: BernoulliLogits)
- uniform_reparam_transform(d: CategoricalProbs)
- uniform_reparam_transform(d: CategoricalLogits)
- uniform_reparam_transform(d: Dirichlet)
A helper for
UniformReparamto get the transform that maps a uniform distribution over a unit hypercube to the target distribution d.