Skip to content

update BEST pymc-example to PyMC v4 #265

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

Merged
merged 11 commits into from
Jan 17, 2022
Merged

update BEST pymc-example to PyMC v4 #265

merged 11 commits into from
Jan 17, 2022

Conversation

asuagar
Copy link
Contributor

@asuagar asuagar commented Jan 9, 2022

update BEST pymc-example to PyMC4 #52

changes

  • update to PyMC 4
  • rename of greek variables spelling them
  • add header
  • update Autorhsip
  • add License section

potential improvements

  • use bib file for bibliography references (it could not be tested because Jupyter does not render MyST cells)
  • deal with NUTS FutureWarning message (it appears to be related to the beta status)
FutureWarning: `Model.initial_point` has been deprecated. Use `Model.recompute_initial_point(seed=None)`.

- update to PyMC 4
- rename of greek variables spelling them
- add header
- update Autorhsip
- add License section
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@review-notebook-app
Copy link

review-notebook-app bot commented Jan 9, 2022

View / edit / reply to this conversation on ReviewNB

OriolAbril commented on 2022-01-09T09:57:42Z
----------------------------------------------------------------

(notebook_id)= is a placeholder for the id that we want to use when linking to this notebook from other notebooks or pages in the versioned docs. I'd suggest using (BEST)= (same as filename) so it's specific and easy to remember.

I would also add some more tags, i.e. hypothesis testing would be interesting, and you'll also need to run pre-commit to add all the pymc objects used as tags: https://docs.pymc.io/en/latest/contributing/jupyter_style.html#pre-commit-and-code-formatting

You also need to fix the date to Jan 07, 2022 


asuagar commented on 2022-01-12T19:12:11Z
----------------------------------------------------------------

Following your recommendations:

  • the id was updated using (BEST)=
  • "hypothesis testing" was added. However, it is not in the actually used tag list https://github.com/pymc-devs/pymc/wiki/Categories-and-Tags-for-PyMC-Examples
  • the date was fixed

@review-notebook-app
Copy link

review-notebook-app bot commented Jan 9, 2022

View / edit / reply to this conversation on ReviewNB

OriolAbril commented on 2022-01-09T09:57:43Z
----------------------------------------------------------------

I don't know what you did here, but the notebook should be executed sequentially on a clean kernel (you can do restart and run all) and after that the code can't be modified.

If there were warnings about constrained layout when using seaborn plots, you can deactivate it here, then activate it right before starting to use arviz plots. Use

plt.rcParams["figure.constrained_layout.use"] = True/False

asuagar commented on 2022-01-12T19:13:59Z
----------------------------------------------------------------

I forgot to uncomment the line and run all on a clean kernel. Sorry for the oversight. I have done it now.

OriolAbril commented on 2022-01-13T01:34:46Z
----------------------------------------------------------------

the seaborn style should not be used. the arviz one is actually based on it and will look very similar, but the colour cycler of the arviz one is colorblind friendly whereas the one in seaborn is not. I think it's not critical in this particular notebook but it's much easier to review and enforce if we just apply it everywhere and also gives a feeling of coherence as if the notebooks were chapters of a single book instead of a random collection of pymc resources

@review-notebook-app
Copy link

review-notebook-app bot commented Jan 9, 2022

View / edit / reply to this conversation on ReviewNB

OriolAbril commented on 2022-01-09T09:57:44Z
----------------------------------------------------------------

Use PyMC only. This is confusing but from now on, the name of the library will be PyMC, if we wanted to specifically refer to its 4.x version we'd use PyMC 4.x, PyMC v4 or PyMC 4. PyMC4 was an experiment that was abandoned that tried to build pymc on top of tensorflow probability


asuagar commented on 2022-01-12T19:16:04Z
----------------------------------------------------------------

Ok. The text has been modified. Now it uses "PyMC" only.

@review-notebook-app
Copy link

review-notebook-app bot commented Jan 9, 2022

View / edit / reply to this conversation on ReviewNB

OriolAbril commented on 2022-01-09T09:57:45Z
----------------------------------------------------------------

This should not be added manually. You have to use the include directive as shown here: https://docs.pymc.io/en/latest/contributing/jupyter_style.html#epilogue


asuagar commented on 2022-01-12T19:16:56Z
----------------------------------------------------------------

The section "License" has been deleted. Now there is only the cell recommended in the link without any title.

@OriolAbril
Copy link
Member

use bib file for bibliography references (it could not be tested because Jupyter does not render MyST cells)

You have the syntax showing how to use references at https://docs.pymc.io/en/latest/contributing/jupyter_style.html#references. Jupyter can't render myst because cross-references, citations... require building all the files that comprise the documentation at the same time. However, jupyter renders only file per file. You can build the docs with sphinx following the guidance on https://github.com/pymc-devs/pymc-examples/blob/main/CONTRIBUTING.md#contributor-guide or push to the PR and wait for the readthedocs check (currently failing due to the date issue in the post directive) to generate a preview.

@OriolAbril OriolAbril mentioned this pull request Jan 9, 2022
@OriolAbril OriolAbril changed the title update BEST pymc-example to PyMC4 #52 update BEST pymc-example to PyMC v4 Jan 9, 2022
- update to PyMC 4
- rename of greek variables spelling them
- add header
- update Autorhsip
- add License section
- use bib file for bibliography references
@OriolAbril
Copy link
Member

@asuagar you deleted the whole notebook in the latest commit

Copy link
Contributor Author

asuagar commented Jan 12, 2022

Following your recommendations:

  • the id was updated using (BEST)=
  • "hypothesis testing" was added. However, it is not in the actually used tag list https://github.com/pymc-devs/pymc/wiki/Categories-and-Tags-for-PyMC-Examples
  • the date was fixed

View entire conversation on ReviewNB

Copy link
Contributor Author

asuagar commented Jan 12, 2022

I forgot to uncomment the line and run all on a clean kernel. Sorry for the oversight. I have done it now.


View entire conversation on ReviewNB

Copy link
Contributor Author

asuagar commented Jan 12, 2022

Ok. The text has been modified. Now it uses "PyMC" only.


View entire conversation on ReviewNB

Copy link
Contributor Author

asuagar commented Jan 12, 2022

The section "License" has been deleted. Now there is only the cell recommended in the link without any title.


View entire conversation on ReviewNB

Copy link
Contributor Author

asuagar commented Jan 12, 2022

Sorry for the mess. I have never done a GitHub commit using the console. It is being a headache trying to figure the right commands. I will try to make a new PR with the new files. Also, the "references.bib" file has been modified with the new references.

@asuagar
Copy link
Contributor Author

asuagar commented Jan 12, 2022

@OriolAbril, you have to apologize my inexperience. I have done a new fork and updated two files (BEST.ipynb and references.bib). I do not know if the best option is (1) "Close with comment" this PR and make a new one or (2) doing other thing. I wait for your instructions.

Copy link
Member

the seaborn style should not be used. the arviz one is actually based on it and will look very similar, but the colour cycler of the arviz one is colorblind friendly whereas the one in seaborn is not. I think it's not critical in this particular notebook but it's much easier to review and enforce if we just apply it everywhere and also gives a feeling of coherence as if the notebooks were chapters of a single book instead of a random collection of pymc resources


View entire conversation on ReviewNB

@review-notebook-app
Copy link

review-notebook-app bot commented Jan 13, 2022

View / edit / reply to this conversation on ReviewNB

OriolAbril commented on 2022-01-13T01:39:30Z
----------------------------------------------------------------

I would use cite:t here. t stands for textual and p for parenthesis and indicate the format to use for the inline citation.


asuagar commented on 2022-01-14T14:54:45Z
----------------------------------------------------------------

Updated. "{cite:t}" used as recommended.

@OriolAbril
Copy link
Member

I added two extra nits now that it seems like the notebook is part of the PR again, but I can't find the notebook in the website preview: https://pymc--265.org.readthedocs.build/projects/examples/en/265/. Maybe it's best to open a new PR.

Sorry you had issues with git and branches. Were the instructions on https://github.com/pymc-devs/pymc-examples/blob/main/CONTRIBUTING.md not clear enough? What could be changed to make things more clear?

Copy link
Contributor Author

asuagar commented Jan 14, 2022

Fixed. "{cite:t}" as recommended.


View entire conversation on ReviewNB

Copy link
Contributor Author

asuagar commented Jan 14, 2022

The problem is not guide itself. It is exhaustive and precise. The issue is my low level of knowledge of Git and Github. I have never done something similar before. I will do a new PR. Sorry for the inconveniences.

@asuagar
Copy link
Contributor Author

asuagar commented Jan 14, 2022

It is curious. The new commits are added to this PR. Would it be better to close this one and start other one?

@OriolAbril
Copy link
Member

no need for a new PR. This has everything ready :). Here is the preview to the notebook: https://pymc--265.org.readthedocs.build/projects/examples/en/265/case_studies/BEST.html

You'll see that references are missing, even though they are working in other examples. IIRC, bibtex keys are case sensitive, but it looks like the sphinx extension that simulates bibtex functionality doesn't find the citations when using uppercase letters. Can you try using only lowercase? Other than that everything looks great, thanks!

@asuagar
Copy link
Contributor Author

asuagar commented Jan 14, 2022

I have updated the references.bib and the notebook for using lowercase references. I hope that it works. Thanks for your patience!

Copy link
Member

@OriolAbril OriolAbril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks great on the preview, waiting for someone else to double check there is nowhere in the code where we could take advantage of v4 features cc @twiecki @ricardoV94 maybe? Then we can merge

@twiecki twiecki merged commit d9d7ef2 into pymc-devs:main Jan 17, 2022
@twiecki
Copy link
Member

twiecki commented Jan 17, 2022

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants