pymc.sample_posterior_predictive_w#
- pymc.sample_posterior_predictive_w(traces, samples=None, models=None, weights=None, random_seed=None, progressbar=True, return_inferencedata=True, idata_kwargs=None)[source]#
Generate weighted posterior predictive samples from a list of models and a list of traces according to a set of weights.
- Parameters
- traces
list
orlist
oflists
List of traces generated from MCMC sampling (xarray.Dataset, arviz.InferenceData, or MultiTrace), or a list of list containing dicts from find_MAP() or points. The number of traces should be equal to the number of weights.
- samples
int
, optional Number of posterior predictive samples to generate. Defaults to the length of the shorter trace in traces.
- models
list
ofModel
List of models used to generate the list of traces. The number of models should be equal to the number of weights and the number of observed RVs should be the same for all models. By default a single model will be inferred from
with
context, in this case results will only be meaningful if all models share the same distributions for the observed RVs.- weightsarray_like, optional
Individual weights for each trace. Default, same weight for each model.
- random_seed
int
,RandomState
orGenerator
, optional Seed for the random number generator.
- progressbarbool, optional default
True
Whether or not to display a progress bar in the command line. The bar shows the percentage of completion, the sampling speed in samples per second (SPS), and the estimated remaining time until completion (“expected time of arrival”; ETA).
- return_inferencedatabool
Whether to return an
arviz.InferenceData
(True) object or a dictionary (False). Defaults to True.- idata_kwargs
dict
, optional Keyword arguments for
pymc.to_inference_data()
- traces
- Returns
arviz.InferenceData
orDict
An ArviZ
InferenceData
object containing the posterior predictive samples from the weighted models (default), or a dictionary with variable names as keys, and samples as numpy arrays.