-
-
Notifications
You must be signed in to change notification settings - Fork 272
update notebook: Update Priors #692
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 |
|
||
+++ | ||
|
||
In this notebook, I will show how it is possible to update the priors as new data becomes available. The example is a slightly modified version of the linear regression in the [Getting started with PyMC3](https://github.com/pymc-devs/pymc3/blob/master/docs/source/notebooks/getting_started.ipynb) notebook. | ||
In this notebook, we will show how it is possible to update the priors as new data becomes available. |
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 would add a note that this is actually a bit sketchy as the MC error can creep in. I think the last plot actually shows that as some posteriors jump.
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.
+1
I'll try to track the original author. I think this is a very nice usage example for Interpolated. But we should be a bit more clear this isn't really a good idea to do in practice not only for the posterior->kde part, but mostly because Interpolated distributions used as priors are unidimensional and uncorrelated, so even if a perfect fit marginally they don't really incorporate all the information we have from the previous posterior into the model, especially when posterior variables are correlated. I wrote a bit on this a while ago https://oriolabrilpla.cat/en/blog/posts/2022/too-eager-reduction.html#univariate-priors It might also be nice to show or maybe only mention the functionality in https://www.pymc.io/projects/experimental/en/latest/generated/pymc_experimental.utils.prior.prior_from_idata.html which should probably work better for correlated posteriors close to normal, but probably worse than this approach for not correlated but far from normal (with no clear transformation) posteriors. |
Thanks for the feedback @twiecki and @OriolAbril . In cd0b93b, I added some words of caution (as suggested) and some additional references. I think we should update this notebook as this topic often comes with new practitioners. If we feel the approach can do more harm than good, we can also think about deleting the notebook. (I think we should keep it with these words of caution, but I am easy). Also, I haven't been able to track the original author since the commit history started after the pymc3 migration. |
Original PR: pymc-devs/pymc#1878 |
🙏 Wow! 2017! |
from scipy import stats | ||
from theano import as_op | ||
from tqdm.notebook import trange |
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 pymc still use tqdm for progressbars? It thought it had been changed
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.
It uses rich now but tqdm is easier to work with for me
I have added some comments. Some are suggestions on the myst file, but the editing process should continue to be work on the ipynb, save then run pre-commit |
Co-authored-by: Oriol Abril-Pla <oriol.abril.pla@gmail.com>
Co-authored-by: Oriol Abril-Pla <oriol.abril.pla@gmail.com>
Co-authored-by: Oriol Abril-Pla <oriol.abril.pla@gmail.com>
Co-authored-by: Oriol Abril-Pla <oriol.abril.pla@gmail.com>
Amazing! Thanks! Indeed! JupyText to the rescue! |
Thank you @OriolAbril ! |
Update https://www.pymc.io/projects/examples/en/latest/howto/updating_priors.html to PyMC 5
Related to #115
It was still using PyMC3 and Theano :/
📚 Documentation preview 📚: https://pymc-examples--692.org.readthedocs.build/en/692/