arviz.convert_to_inference_data#
- 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
objto the right conversion function. It is idempotent, in that it will return arviz.InferenceData objects unchanged.- Parameters:
- obj
dict,str,np.ndarray,xr.Dataset,pystanfit - A supported object to convert to InferenceData:
- InferenceData: returns unchangedstr: Attempts to load the cmdstan csv or netcdf dataset from diskpystan fit: Automatically extracts datacmdstanpy fit: Automatically extracts datacmdstan csv-list: Automatically extracts dataemcee sampler: Automatically extracts datapyro MCMC: Automatically extracts databeanmachine MonteCarloSamples: Automatically extracts dataxarray.Dataset: adds to InferenceData as only groupxarray.DataArray: creates an xarray dataset as the only group, gives the array an arbitrary name, if name not setdict: creates an xarray dataset as the only groupnumpy array: creates an xarray dataset as the only group, gives the array an arbitrary nameobject with __array__: converts to numpy array, then creates an xarray dataset as the only group, gives the array an arbitrary name
- group
str If
objis a dict or numpy array, assigns the resulting xarray dataset to this group. Default: “posterior”.- coords
dict[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.
- dims
dict[str,List(str)] A mapping from variables to a list of coordinate names for the variable
- kwargs
Rest of the supported keyword arguments transferred to conversion function.
- obj
- Returns: