Skip to content

sample_prior_predictive does not work for simple model with LKJ distribution #3246

Closed
@FedericoV

Description

@FedericoV

If you have questions about a specific use case, or you are not sure whether this is a bug or not, please post it to our discourse channel: https://discourse.pymc.io

Description of your problem

Sampling the prior predictive distribution of an LKJ distribution gives an error

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

import pymc3 as pm

with pm.Model() as model:
    sd_dist = pm.HalfCauchy.dist(beta=1, shape=10)
    chol_packed = pm.LKJCholeskyCov(name='chol_packed', n=20,
                                    eta=1.0, sd_dist=sd_dist)
    chol = pm.expand_packed_triangular(20, chol_packed)

with model:
    pm.sample_prior_predictive(50)

Please provide the full traceback.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-5-7300cc3c60ce> in <module>()
      8
      9 with model:
---> 10     pm.sample_prior_predictive(50)
     11

~/anaconda3/lib/python3.6/site-packages/pymc3-3.5-py3.6.egg/pymc3/sampling.py in sample_prior_predictive(samples, model, vars, random_seed)
   1332     names = get_default_varnames(model.named_vars, include_transformed=False)
   1333     # draw_values fails with auto-transformed variables. transform them later!
-> 1334     values = draw_values([model[name] for name in names], size=samples)
   1335
   1336     data = {k: v for k, v in zip(names, values)}

~/anaconda3/lib/python3.6/site-packages/pymc3-3.5-py3.6.egg/pymc3/distributions/distribution.py in draw_values(params, point, size)
    310     while to_eval or missing_inputs:
    311         if to_eval == missing_inputs:
--> 312             raise ValueError('Cannot resolve inputs for {}'.format([str(params[j]) for j in to_eval]))
    313         to_eval = set(missing_inputs)
    314         missing_inputs = set()

ValueError: Cannot resolve inputs for ['chol_packed']

Please provide any additional information below.

Versions and main components

  • PyMC3 Version: git commit: cd453bc (master branch, bleeding edge)
  • Theano Version: 1.03
  • Python Version: 3.06
  • Operating system: osX
  • How did you install PyMC3: (conda/pip) git clone

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions