-
-
Notifications
You must be signed in to change notification settings - Fork 269
Update Jupyter style in lasso notebook #279
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
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
@@ -4,40 +4,75 @@ | |||
"cell_type": "markdown", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line #2. initvals = pm.find_MAP()
it might be best to get rid of this completely instead of updating to use initvals. Is there any reason to use the map as initial point?
Reply via ReviewNB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did, however as I side note, once I remove initvals
, sometimes it runs correctly but also many times the sampling hangs and I get some warnings. Specifically, running:
with model:
step1 = pm.Metropolis([beta1, beta2])
step2 = pm.Slice([sigma, tau])
idata = pm.sample(10000, step=[step1, step2])
I sometimes get three of these RuntimeWarnings
/home/user/miniconda3/envs/pymc-test-py39/lib/python3.9/site-packages/pymc/step_methods/metropolis.py:250: RuntimeWarning: overflow encountered in exp
"accept": np.exp(accept),
and the sampling hangs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this happen during tuning or during sampling?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"accept": np.exp(accept)
That's probably an extreme value in the acceptance probability during MCMC. Since you're seeing this go away with MAP initivals, my best guess would be that the prior is far away from the typical set.
Looking at the traceplot below, that's most probably somethin with the "tau" parameter. The default initval for this U(0,1) variable will be 0.5, but the posterior is very close to 0.
Maybe because "lam" increased by 1000x?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the hints. The issue happens during sampling. Also, the lam scaling is equivalent to the original notebook, and I tried changing it to lam=1, leave only tau=HalfNormal(0,1) and some other combinations, but I still get this issue on most runs without initvals. You think I should put initvals back? Also, if I run pm.sample(10000) (without steps and initvals) everything works fine.
Addressing Issue #110
Upgrading with respect to the style guides and v4 practices to reach Best Practices. Main changes:
start
inpm.sample
.I am not sure if changes should be done with respect to v4. Can someone comment on that? @fonnesbeck @CloudChaoszero @michaelosthege
Helpful links