pymc-devs / pymc2

THIS IS THE **OLD** PYMC PROJECT (VERSION 2). PLEASE USE PYMC INSTEAD:
http://pymc-devs.github.com/pymc/
Other
879 stars 229 forks source link

sample_posterior_predictive produces wrongly shaped output #192

Closed thomas-haslwanter closed 5 years ago

thomas-haslwanter commented 5 years ago

The shape of pm.sample_posterior_predictive is wrong. For example, the code

data = np.random.randn(100)
with pm.Model() as model:
    mu = pm.Normal('mu', mu=0, sd=1)
    sd = pm.HalfNormal('sd', sd=1)
    obs = pm.Normal('obs', mu=mu, sd=sd, observed=data)

    trace = pm.sample()
with model:
    post_pred = pm.sample_posterior_predictive(trace, samples=500, size=5)
post_pred['obs'].shape

produces

(500, 5, 100)

instead of the expected (500, 5)

twiecki commented 5 years ago

You probably meant to open this here instead: https://github.com/pymc-devs/pymc3