pymc.predictions_to_inference_data(predictions, posterior_trace=None, model=None, coords=None, dims=None, sample_dims=None, idata_orig=None, inplace=False)[source]#

Translate out-of-sample predictions into InferenceData.

predictions: Dict[str, np.ndarray]

The predictions are the return value of sample_posterior_predictive(), a dictionary of strings (variable names) to numpy ndarrays (draws). Requires the arrays to follow the convention chain, draw, *shape.

posterior_trace: MultiTrace

This should be a trace that has been thinned appropriately for pymc.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: Model

The pymc model. It can be omitted if within a model context.

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.


May be modified idata_orig.