aimz.ImpactModel.sample#

ImpactModel.sample(*, num_samples=1000, rng_key=None, return_sites=None, return_datatree=True, **kwargs)[source]#

Draw posterior samples from a fitted model.

Parameters:
  • num_samples (int) – The number of posterior samples to draw.

  • rng_key (Array | None) – A pseudo-random number generator key. By default, an internal key is used and split as needed. Ignored if the inference method is MCMC, where the post_warmup_state property will be used to continue sampling.

  • return_sites (str | Iterable[str] | None) – Names of variables (sites) to return. If None, samples all latent sites. Ignored if the inference method is MCMC.

  • return_datatree (bool) – If True, return a DataTree; otherwise return a dict.

  • **kwargs (object) – Additional arguments passed to the model. Only relevant when the inference method is MCMC.

Returns:

Posterior samples.

Raises:

TypeError – If param_output is not passed as an argument when the inference method is MCMC.

Return type:

xr.DataTree | dict[str, npt.NDArray]