arviz.convert_to_inference_data(obj, *, group='posterior', coords=None, dims=None, **kwargs)[source]#

Convert a supported object to an InferenceData object.

This function sends obj to the right conversion function. It is idempotent, in that it will return arviz.InferenceData objects unchanged.

objdict, str, np.ndarray, xr.Dataset, pystan fit
A supported object to convert to InferenceData:
InferenceData: returns unchanged
str: Attempts to load the cmdstan csv or netcdf dataset from disk
pystan fit: Automatically extracts data
cmdstanpy fit: Automatically extracts data
cmdstan csv-list: Automatically extracts data
emcee sampler: Automatically extracts data
pyro MCMC: Automatically extracts data
beanmachine MonteCarloSamples: Automatically extracts data
xarray.Dataset: adds to InferenceData as only group
xarray.DataArray: creates an xarray dataset as the only group, gives the array an arbitrary name, if name not set
dict: creates an xarray dataset as the only group
numpy array: creates an xarray dataset as the only group, gives the array an arbitrary name

If obj is a dict or numpy array, assigns the resulting xarray dataset to this group. Default: “posterior”.

coordsdict[str, iterable]

A dictionary containing the values that are used as index. The key is the name of the dimension, the values are the index values.

dimsdict[str, List(str)]

A mapping from variables to a list of coordinate names for the variable


Rest of the supported keyword arguments transferred to conversion function.