-
-
Notifications
You must be signed in to change notification settings - Fork 269
Update first half of generalized linear models to "Best Practices" #148
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 |
View / edit / reply to this conversation on ReviewNB OriolAbril commented on 2021-04-29T21:27:29Z This is the old global seeding version of the numpy random number generator. You have to use the new random generator as shown in the references. OriolAbril commented on 2021-05-01T20:43:59Z Now a generator is initialized, but it is not stored nor used afterwards to generate the random samples. It should be stored (i.e. as KavyaJaiswal commented on 2021-05-03T10:54:44Z I have made the required changes. |
View / edit / reply to this conversation on ReviewNB OriolAbril commented on 2021-04-29T21:27:30Z Here KavyaJaiswal commented on 2021-05-03T10:55:31Z Done! |
View / edit / reply to this conversation on ReviewNB OriolAbril commented on 2021-04-29T21:27:31Z Here you have to use a
This cell does work and you have been able to execute it without problem. But right now it's downloading the data from github every time the cell is executed. If the users have cloned |
View / edit / reply to this conversation on ReviewNB OriolAbril commented on 2021-04-29T21:27:32Z Asked around for help with this error OriolAbril commented on 2021-05-01T22:34:36Z It is probably not worth it to fix those errors. Long term, bambi will replace the glm module, but the timeline is not clear yet. I would suggest working on the other comments as practice (together with the other PRs) and for now leaving this as is until we have had some time to plan the deprecation of the glm module
KavyaJaiswal commented on 2021-05-03T10:59:33Z Fair enough. |
View / edit / reply to this conversation on ReviewNB OriolAbril commented on 2021-04-29T21:27:32Z You need to install the watermark library for this to work, make sure you install it to the right environment, not to "general" or "base" ones. KavyaJaiswal commented on 2021-05-03T10:58:36Z Updated! |
Now a generator is initialized, but it is not stored nor used afterwards to generate the random samples. It should be stored (i.e. as View entire conversation on ReviewNB |
It is probably not worth it to fix those errors. Long term, bambi will replace the glm module, but the timeline is not clear yet. I would suggest working on the other comments as practice (together with the other PRs) and for now leaving this as is until we have had some time to plan the deprecation of the glm module
View entire conversation on ReviewNB |
View / edit / reply to this conversation on ReviewNB OriolAbril commented on 2021-05-01T22:34:46Z The code should be try except directly, not be commented. The ellipsis should not be there either. They are in the guide because many notebooks need to pass extra arguments to KavyaJaiswal commented on 2021-05-03T10:56:16Z Updated accordingly. OriolAbril commented on 2021-05-04T13:54:00Z I would also remove the comment and use a specific exception as Marco pointed out and added to the style guide: https://github.com/pymc-devs/pymc3/wiki/PyMC3-Jupyter-Notebook-Style-Guide |
I have added all the required changes. |
I have made the required changes. View entire conversation on ReviewNB |
Done! View entire conversation on ReviewNB |
Updated accordingly. View entire conversation on ReviewNB |
Updated! View entire conversation on ReviewNB |
Fair enough. View entire conversation on ReviewNB |
I would also remove the comment and use a specific exception as Marco pointed out and added to the style guide: https://github.com/pymc-devs/pymc3/wiki/PyMC3-Jupyter-Notebook-Style-Guide View entire conversation on 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.
Two general comments.
First one is to update the PR title so when we merge it and it becomes a commit message, it will be informative of the changes, to do so it needs to mention the notebook that was modified. Most notebooks will be updated to use the new generator, so without that we'd end up with ~70 identical commit messages.
Second one is to remember to run pre-commit
to ensure that CI passes. There is some guidance on that at https://github.com/pymc-devs/pymc3/wiki/PyMC3-Python-Code-Style
Updated the Pull Request with the suggested changes, |
Description
File: https://github.com/pymc-devs/pymc-examples/blob/main/examples/generalized_linear_models/GLM.ipynb
Addresses issue #91 and aims to advance the notebook to the 'Best Practices' State.
The new code uses the new numpy generator instead of the numpy random. The code also has an ArviZ related addition of return_inferencedata=True
The PR has a try... except clause in the code. It will ensure that users who have cloned pymc-examples repo will read their local copy of the data while also downloading the data from github for those who don't have a local copy.
This PR also addresses the error message in the Hierarchical GLM section of the code. The error in the code is shown in the screenshots attached below. The fix for this error can be discussed and worked upon.