arviz.from_pymc3_predictions#
- arviz.from_pymc3_predictions(predictions, posterior_trace=None, model=None, coords=None, dims=None, idata_orig=None, inplace=False)[source]#
Translate out-of-sample predictions into
InferenceData
.- Parameters
- predictions: Dict[str, np.ndarray]
The predictions are the return value of
pymc3.sample_posterior_predictive
, a dictionary of strings (variable names) to numpy ndarrays (draws).- posterior_trace: pm.MultiTrace
This should be a trace that has been thinned appropriately for
pymc3.sample_posterior_predictive
. Specifically, any variable whose shape is a deterministic function of the shape of any predictor (explanatory, independent, etc.) variables must be removed from this trace.- model: pymc3.Model
This argument is not optional, unlike in conventional uses of
from_pymc3
. The reason is that the posterior_trace argument is likely to supply an incorrect value of model.- coords: Dict[str, array-like[Any]]
Coordinates for the variables. Map from coordinate names to coordinate values.
- dims: Dict[str, array-like[str]]
Map from variable name to ordered set of coordinate names.
- idata_orig: InferenceData, optional
If supplied, then modify this inference data in place, adding
predictions
and (if available)predictions_constant_data
groups. If this is not supplied, make a fresh InferenceData- inplace: boolean, optional
If idata_orig is supplied and inplace is True, merge the predictions into idata_orig, rather than returning a fresh InferenceData object.
- Returns
- InferenceData:
May be modified
idata_orig
.