Skip to content

Shape issues when sampling prior predictive with MvNormal #3829

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
fbartolic opened this issue Mar 10, 2020 · 2 comments
Closed

Shape issues when sampling prior predictive with MvNormal #3829

fbartolic opened this issue Mar 10, 2020 · 2 comments

Comments

@fbartolic
Copy link

I'm not sure if the this is intended or not, but I'm getting inconsistent shapes for a MvNormal RV depending on if I sample the prior with pm.sample or pm.sample_prior_predictive. Here's a minimal example:

import pymc3 as pm
import numpy as np

with pm.Model() as model:
    x = pm.MvNormal("x", mu=np.zeros(5), cov=np.eye(5), shape=(2, 5))
    trace = pm.sample(50)
    trace_pp = pm.sample_prior_predictive(50)
    
print(np.shape(trace['x'][0]))
print(np.shape(trace_pp['x'][0]))

I get the following output:

(2, 5)
(5,)

I would expect the shape of a sample from the predictive distribution to be (2, 5) rather than (5,).

Versions and main components

  • PyMC3 Version: 3.8
  • Theano Version: 1.0.4
  • Python Version: 3.8
  • Operating system: Mac
  • How did you install PyMC3: pip
@lucianopaz
Copy link
Contributor

Related to #2848 and #3706. The MvNormal.random method is buggy.

@canyon289
Copy link
Member

Since this is related closing

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

3 participants