aimz.ImpactModel.sample_prior_predictive#

ImpactModel.sample_prior_predictive(X, *, num_samples=1000, rng_key=None, return_sites=None, batch_size=None, output_dir=None, progress=True, **kwargs)[source]#

Draw samples from the prior predictive distribution.

Results are written to disk in the Zarr format, with computing and file writing decoupled and executed concurrently.

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

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

  • 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.

  • batch_size (int | None) – The batch size for data loading during prior predictive sampling. It also determines the chunk size used to store the samples. If None, it is determined automatically based on the input data and number of samples.

  • output_dir (str | Path | None) – The directory where the outputs will be saved. If the specified directory does not exist, it will be created automatically. If None, a default temporary directory will be created. A timestamped subdirectory will be generated within this directory to store the outputs. Outputs are saved in the Zarr format.

  • progress (bool) – Whether to display a progress bar.

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

Returns:

Prior predictive samples. Posterior samples are included if available.

Raises:
Return type:

xr.DataTree

See also

sample_prior_predictive_on_batch() for an in-memory alternative.

cleanup() to remove the temporary directory if created.