Skip to content
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

sample_prior_predictive() sample parameter fails on tuple (models with deterministics and symbolic tensors?) #3422

Closed
gbernstein6 opened this issue Mar 22, 2019 · 1 comment

Comments

@gbernstein6
Copy link

Description of your problem

sample_prior_predictive() sample parameter fails on tuple (models with deterministics and symbolic tensors?) as per discussion from @lucianopaz here

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

import pymc3 as pm

with pm.Model():
    var = pm.distributions.continuous.InverseGamma('var', alpha=1, beta=1)
    pm.distributions.continuous.Normal('x', mu=0, sd=pm.math.sqrt(var))

    print(pm.sample_prior_predictive(samples=(1,10)))

Please provide the full traceback.

  File "//anaconda3/lib/python3.7/site-packages/pymc3/sampling.py", line 1325, in sample_prior_predictive
    values = draw_values([model[name] for name in names], size=samples)
  File "//anaconda3/lib/python3.7/site-packages/pymc3/distributions/distribution.py", line 369, in draw_values
    size=size)
  File "//anaconda3/lib/python3.7/site-packages/pymc3/distributions/distribution.py", line 463, in _draw_value
    return param.random(point=point, size=size)
  File "//anaconda3/lib/python3.7/site-packages/pymc3/model.py", line 43, in __call__
    return getattr(self.obj, self.method_name)(*args, **kwargs)
  File "//anaconda3/lib/python3.7/site-packages/pymc3/distributions/continuous.py", line 457, in random
    point=point, size=size)
  File "//anaconda3/lib/python3.7/site-packages/pymc3/distributions/distribution.py", line 400, in draw_values
    size=size)
  File "//anaconda3/lib/python3.7/site-packages/pymc3/distributions/distribution.py", line 508, in _draw_value
    output = np.array([func(*v) for v in zip(*values)])
  File "//anaconda3/lib/python3.7/site-packages/pymc3/distributions/distribution.py", line 508, in <listcomp>
    output = np.array([func(*v) for v in zip(*values)])
  File "//anaconda3/lib/python3.7/site-packages/theano/compile/function_module.py", line 813, in __call__
    allow_downcast=s.allow_downcast)
  File "//anaconda3/lib/python3.7/site-packages/theano/tensor/type.py", line 178, in filter
    data.shape))
TypeError: Bad input argument to theano function with name "//anaconda3/lib/python3.7/site-packages/pymc3/distributions/distribution.py:431" at index 0 (0-based). Wrong number of dimensions: expected 0, got 1 with shape (10,).

Versions and main components

  • PyMC3 Version: 3.6
  • Theano Version: 1.0.3
  • Python Version: 3.7.1
  • Operating system: Mac OSX 10.13.6
  • How did you install PyMC3: conda
@lucianopaz
Copy link
Contributor

Closed via #3456

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants