Skip to content

Shape issues when sampling prior predictive with MvNormal #3829

Closed
@fbartolic

Description

@fbartolic

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions