arviz_base.from_dict#
- arviz_base.from_dict(data, *, name=None, sample_dims=None, save_warmup=None, index_origin=None, coords=None, dims=None, pred_dims=None, pred_coords=None, check_conventions=True, attrs=None)[source]#
Convert nested dictionary into a DataTree.
It uses
dict_to_datasetto convert a nested dictionary to a DataTree using ArviZ conventions.- Parameters:
- datamapping of {hashablemapping of {hashablearray_like}}
Dictionary to convert to DataTree. It must be a nested dictionary. The keys of the outer dictionary are group names, the values of the outer dictionary must be dictionaries themselves with the variables that should be stored in that group. These inner dictionaries are passed to
dict_to_dataset.Depending on the group name, the arguments used when calling
dict_to_datasetcan take different arguments from their defaults:If
datais a substring of the group name,sample_dimswill be set to an empty list:[]If
predictionsis a substring of the group name, pred_coords and pred_dims will be passed todict_to_datasetascoordsanddims.If
log_likelihoodis a substring of the group name,skip_event_dimsis set toTrue.
- name
str, optional Name of the DataTree root node. This is used as the DataTree name by ArviZ.
- sample_dimssequence of hashable, optional
Dimensions that should be assumed to be present in _all_ variables. If missing, they will be added as the dimensions corresponding to the leading axis.
- save_warmupbool, optional
Save warmup iterations DataTree. If not defined, use default defined by the rcParams. When set to
False, groups in data that havewarmupas substring will be ignored.- index_origin
int, optional Start value to use default integer ids for dimensions without provided coordinate values. Defaults to
data.index_origin.- coordsmapping of {hashablearray_like}, optional
A dictionary containing the values that are used as index. The key is the name of the dimension, the values are the index values.
- dimsmapping of {hashablesequence of hashable}, optional
A mapping from variable names to a list of dimension names for the variable.
- pred_dimsmapping of {hashablesequence of hashable}, optional
A mapping from variables to a list of coordinate names for predictions.
- pred_coordsmapping of {hashablearray_like}, optional
A mapping from variables to a list of coordinate values for predictions.
- check_conventionsbool, default
True Check some ArviZ conventions on dimension meaning.
- attrsmapping of {hashablemapping of {hashable
any}}, optional A dictionary containing attributes for different groups. Its keys should match keys in data, with the exception of “/” which is used to set global attributes.
- Returns:
See also
datatree.DataTree.from_dict