aimz.ImpactModel.log_likelihood#
- ImpactModel.log_likelihood(X, y=None, *, batch_size=None, output_dir=None, progress=True, **kwargs)[source]#
Compute the log-likelihood of the data under the given model.
Results are written to disk in the Zarr format, with computing and file writing decoupled and executed concurrently.
- Parameters:
X (ArrayLike | ArrayLoader) – Input data. If array-like, the leading axis is the sample axis. Alternatively, a data loader that holds all array-like objects and handles batching internally.
y (ArrayLike | None) – Output data. The leading axis is the sample axis. Must be
NoneifXis a data loader.batch_size (int | None) – The batch size for data loading during log-likelihood computation. 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. Ignored ifXis a data loader, in which case the data loader is expected to handle batching internally.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:
Log-likelihood values. Posterior samples are included if available.
- Raises:
NotImplementedError – If a return site’s axis-1 size does not match the input batch size.
- Return type:
xr.DataTree
See also
cleanup()to remove the temporary directory if created.