aimz.ImpactModel.sample_posterior_predictive_on_batch#

ImpactModel.sample_posterior_predictive_on_batch(X, *, intervention=None, rng_key=None, return_sites=None, return_datatree=True, **kwargs)[source]#

Draw samples from the posterior predictive distribution.

This method is a convenience alias for predict_on_batch(), with in_sample automatically set to True.

Parameters:
  • X (ArrayLike) – Input data. The leading axis is the sample axis.

  • intervention (dict | None) – A dictionary mapping sample sites to their corresponding intervention values. Interventions enable counterfactual analysis by modifying the specified sample sites during prediction (posterior predictive sampling).

  • rng_key (Array | None) – A pseudo-random number generator key. By default, an internal key is used and split as needed.

  • return_sites (str | Iterable[str] | None) – Names of variables (sites) to return. If None, samples param_output and deterministic sites.

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

  • **kwargs (object) – Additional arguments passed to the model.

Returns:

Posterior predictive samples. Posterior samples are included if available.

Raises:

TypeError – If param_output is passed as an argument.

Return type:

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

See also

predict_on_batch().