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

Section 2 pymc3 error #14

Closed
ghost opened this issue Feb 2, 2017 · 5 comments
Closed

Section 2 pymc3 error #14

ghost opened this issue Feb 2, 2017 · 5 comments

Comments

@ghost
Copy link

ghost commented Feb 2, 2017

Section 2 - Model Check II - Bayes Factor

Model fails

14 
  15     y_like = pm.DensityDist('y_like',
---> 16              lambda value: pm.switch(tau, 
  17                  pm.Poisson.dist(mu_p).logp(value),
  18                  pm.NegativeBinomial.dist(mu_nb, alpha).logp(value)

AttributeError: module 'pymc3' has no attribute 'switch'

Found a fix suggested by Cameron Davidson-Pilson which looks like it was intended to be merged into your code (but seems it wasn't?). The suggested revision to lambda works fine.

  y_like = pm.DensityDist('y_like',
               lambda value: pm.math.switch(tau, 
                   pm.Poisson.dist(mu_p).logp(value),
                   pm.NegativeBinomial.dist(mu_nb, alpha).logp(value)
               ),
               observed=messages['time_delay_seconds'].values)
@twiecki
Copy link
Contributor

twiecki commented Feb 2, 2017

Yep, we changed that namespace, easy fix.

@twiecki
Copy link
Contributor

twiecki commented Feb 2, 2017

@krispy1946 Maybe do a PR.

@ghost
Copy link
Author

ghost commented Feb 2, 2017 via email

@markdregan
Copy link
Owner

Thanks for flagging Chris. I'm re-running all notebooks now and fixing issues. Been a while and PYMC3 has come on even further since I last used it. Will push later this weekend.

@markdregan
Copy link
Owner

Pushed updated notebooks.
pm.math.switch issue fixed.

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

2 participants