pymc.to_inference_data#

pymc.to_inference_data(trace=None, *, prior=None, posterior_predictive=None, log_likelihood=False, log_prior=False, coords=None, dims=None, sample_dims=None, model=None, save_warmup=None, include_transformed=False)[source]#

Convert pymc data into an InferenceData object.

All three of them are optional arguments, but at least one of trace, prior and posterior_predictive must be present. For a usage example read the Creating InferenceData section on from_pymc

Parameters:
traceMultiTrace, optional

Trace generated from MCMC sampling. Output of sample().

priordict, optional

Dictionary with the variable names as keys, and values numpy arrays containing prior and prior predictive samples.

posterior_predictivedict, optional

Dictionary with the variable names as keys, and values numpy arrays containing posterior predictive samples.

log_likelihoodbool or array_like of str, optional

List of variables to calculate log_likelihood. Defaults to False. If set to True, computes log_likelihood for all observed variables.

log_priorbool or array_like of str, optional

List of variables to calculate log_prior. Defaults to False. If set to True, computes log_prior for all unobserved variables.

coordsdict of {str: array_like}, optional

Map of coordinate names to coordinate values

dimsdict of {str: list of str}, optional

Map of variable names to the coordinate names to use to index its dimensions.

modelModel, optional

Model used to generate trace. It is not necessary to pass model if in with context.

save_warmupbool, optional

Save warmup iterations InferenceData object. If not defined, use default defined by the rcParams.

include_transformedbool, optional

Save the transformed parameters in the InferenceData object. By default, these are not saved.

Returns:
arviz.InferenceData