Skip to content

Upgrade notebook Gaussian Process to V4 #404

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 7 commits into from
Aug 3, 2022

Conversation

symeneses
Copy link
Contributor

@symeneses symeneses commented Jul 26, 2022

It solves #79
The number of particles n_particles was changed to 100 to get the notebook executed within an acceptable time.
Thanks to @cluhmann @fonnesbeck for your help 🔥

Co-authored-by: @AnaRita93

#DataUmbrellaPyMCSprint

Gaussian Process notebook

Helpful links

Co-authored-by: Ana Rita Santos <[email protected]>
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@symeneses
Copy link
Contributor Author

We have 2 observations:

  1. In the cell:
y_pred = [

    np.random.multivariate_normal(m, S)
    for m, S in zip(gp_trace.posterior["mu_post"].T, gp_trace.posterior["sigma_post"].T)
]

We use Transpose to get the right dimensions, but not sure if this was the best way to do it.

  1. It seems that the notebooks name is misleading, as the name indicates that the notebook is about GP in general, but that's not the case. The other notebooks in the folder are named GP-XXX. Should we change the name?

@OriolAbril OriolAbril linked an issue Jul 26, 2022 that may be closed by this pull request
@OriolAbril
Copy link
Member

It seems that the notebooks name is misleading, as the name indicates that the notebook is about GP in general, but that's not the case. The other notebooks in the folder are named GP-XXX. Should we change the name?

I am not very opinionated on this right now, but I will oppose changing the name if it comes up in the future. Currently most of the old links are broken (in the sense that they point to v3 docs, but using the version switcher ends up in a 404 page), so changing the name right now has very little effect. Once the updated www.pymc.io/projects/examples/ links are extended, changing the name will break many references to the docs, so I don't think it would be a good idea to do anymore.

@cluhmann
Copy link
Member

I am not understanding the Read the Docs error message. It seems to be complaining about another notebooks. @OriolAbril ?

@OriolAbril
Copy link
Member

I am not understanding the Read the Docs error message. It seems to be complaining about another notebooks. @OriolAbril ?

Already commented above, but I'll add some extra info here for full context. The line right above the error message makes reference to a different notebook yes, but that is a sphinx warning, not an error. It is something that we should be aware of and try to fix it (it might become an actual error in a future version for example), but it is not breaking the doc build. The error references:

File "/home/docs/checkouts/readthedocs.org/user_builds/pymc-examples/envs/404/lib/python3.8/site-packages/ablog/post.py", line 40, in _split
    return {s.strip() for s in a.split(",")}
AttributeError: 'NoneType' object has no attribute 'split'

which means that what is breaking the doc build is something related to the post directive, it doesn't give specific information about what exactly in the post directive is breaking everything. That I am inferring/deducing from the bad format of the date in the post directive plus the split(",") piece; the expected format has a comma, the year only that is currently present does not. My guess is instead of splitting into two substrings, no splitting can happen and a None appears somewhere the ablog extension expects a string and we get the error.

@OriolAbril
Copy link
Member

Looks like I did not guess the cause of the readthedocs issue 😕 . Can you try adding ablog<0.10.27 to https://github.com/pymc-devs/pymc-examples/blob/main/requirements-docs.txt#L7? It looks like they made a new release in a date that could explain the errors (I'll try to look into this later on once I have time and see if the release introduced a bug or if we are doing something wrong)

@symeneses
Copy link
Contributor Author

Looks like I did not guess the cause of the readthedocs issue 😕 . Can you try adding ablog<0.10.27 to https://github.com/pymc-devs/pymc-examples/blob/main/requirements-docs.txt#L7? It looks like they made a new release in a date that could explain the errors (I'll try to look into this later on once I have time and see if the release introduced a bug or if we are doing something wrong)

I tested locally with ablog 0.10.26 and it worked, so let's see. I added the related issue in the comment.

@OriolAbril
Copy link
Member

OriolAbril commented Aug 2, 2022

It looks like some of the updated versions (no idea what though) is breaking the thumbnail gallery: https://pymcio--404.org.readthedocs.build/projects/examples/en/404/gallery.html.

This one seems to be the last working build for pymc-examples. For now, can you check the versions used there for sphinx and sphinx gallery and pin them? Then open an issue as a reminder to look into this and fix it.

## Authors
* Adapted from Stan's [example-models repository](https://github.com/stan-dev/example-models/blob/master/misc/gaussian-process/gp-fit.stan) by Chris Fonnesbeck in 2016
* Updated by Ana Rita Santos and Sandra Meneses in July, 2022 ([pymc#404](https://github.com/pymc-devs/pymc/pull/404))

```{code-cell} ipython3
Copy link
Member

Choose a reason for hiding this comment

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

There should be a watermark title right above this cell: https://docs.pymc.io/en/latest/contributing/jupyter_style.html#watermark

@OriolAbril OriolAbril merged commit 50db852 into pymc-devs:main Aug 3, 2022
@symeneses
Copy link
Contributor Author

The error in the gallery is still there 😭 . I updated the issue with some more details.

@symeneses symeneses deleted the nb-gaussian-process branch August 3, 2022 08:08
@OriolAbril
Copy link
Member

I checked the preview and the gallery now and it seems to be working for me. Does it still happen for you after refreshing multiple times or trying a different browser?

@symeneses
Copy link
Contributor Author

I checked the preview and the gallery now and it seems to be working for me. Does it still happen for you after refreshing multiple times or trying a different browser?

Niiice, it's working fine now. No need to cry 😉

kuvychko pushed a commit to kuvychko/pymc-examples that referenced this pull request Oct 20, 2022
* ⬆️ upgrade nb to V4

Co-authored-by: Ana Rita Santos <[email protected]>

* 👌 updates due to review comments

* 👌 sampling with multivariate_normal from xarray_einstats dev

* 📌 set ablog version

* 🍻 🐛 fix the pinning

* 📌 pin sphinx and sphinx gallery

* 📝 add watermark header

Co-authored-by: Ana Rita Santos <[email protected]>
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.

gaussian processes
4 participants