def run_ppc(trace, samples=100, model=None):
    """Generate Posterior Predictive samples from a model given a trace.
    """
if model is None:
    model = pm.modelcontext(model)
ppc = defaultdict(list)
for idx in np.random.randint(0, len(trace), samples):
    param = trace[idx]
for obs in model.observed_RVs:
    ppc[obs.name].append(obs.distribution.random(point=param))
return ppc
Генерация прогнозов на основе предполагаемых параметров в pymc3