Skip to content

InferenceData from prior predictions without constant data #5722

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TimOliverMaier opened this issue Apr 21, 2022 · 0 comments
Closed

InferenceData from prior predictions without constant data #5722

TimOliverMaier opened this issue Apr 21, 2022 · 0 comments

Comments

@TimOliverMaier
Copy link
Contributor

constant_data missing after pm.sample_prior_predictive()

In some use-cases one might want to sample and plot prior predictions before sampling the posterior. For
this purpose, it would be nice to have "constant_data" group in the az.InferenceData object, that
pm.sample_prior_predictive() returns.

Please provide a minimal, self-contained, and reproducible example.

import pymc as pm
import numpy as np

x = np.arange(-10,10)
y = 2*x+1.4+np.random.normal(0,0.3,x.size)

with pm.Model() as model:
    x = pm.MutableData("x",x)
    y = pm.MutableData("y",y)
    a = pm.Normal("a",mu=1,sigma=2)
    b = pm.Normal("b",mu=0,sigma=2)

    mu = pm.Deterministic("mu",var=a*x+b)
    e = pm.Exponential("e",lam=10)

    obs = pm.Normal("obs",mu=mu,sigma=e,observed=y)

with model:
    prior_pred = pm.sample_prior_predictive(model=model)

In the example above prior_pred has following groups:
+prior
+prior_predictive
+observed_data

Versions and main components

  • PyMC/PyMC3 Version: d322f7 (current main branch v4)
  • Aesara/Theano Version: e5ebf2 (current main branch)
  • Python Version: 3.10.4
  • Operating system: Ubuntu 20.4
  • How did you install PyMC/PyMC3: (conda/pip) pip -e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants