Skip to content
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

Update GP NBs to use standard notebook style #3978

Merged
merged 5 commits into from
Jun 26, 2020

Conversation

bwengals
Copy link
Contributor

Updates the examples to use the standard notebook style, #3959, as outlined here.

Should figure sizes / font sizes also be standardized? @michaelosthege @AlexAndorra.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

Review Jupyter notebook visual diffs & provide feedback on notebooks.


Powered by ReviewNB

Copy link
Contributor

@AlexAndorra AlexAndorra left a comment

Choose a reason for hiding this comment

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

This is great, thanks for your help @bwengals !
LGTM, except for:

  • Is it expected that the GP for classification example seems less able to recover the true f than in the earlier version of the NB? Would you consider the performance in the new version good enough?
  • I'm not sure you ran black_nbconvert on the NB (see NB style Wiki)
  • Oddly enough, test_matrix_multiplication is failing, but I don't see how that's related to the changes you did here 🤔

@michaelosthege
Copy link
Member

Looks great! Can you add assert all(r_hat < 1.03) or similar after the samplings?

@bwengals
Copy link
Contributor Author

bwengals commented Jun 24, 2020

@AlexAndorra I think the original problem was just easier, those variations around 0.5 were hard to pick up with the small data set. I added more data and fixed the random seed so the results are better.

Nope, totally forgot about black_nbconvert, thanks! I'll see if that test still fails after fixing the other things.

@michaelosthege that's a good idea, will add that.

Copy link
Contributor

@AlexAndorra AlexAndorra left a comment

Choose a reason for hiding this comment

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

Thanks @bwengals ! This is almost ready, just added some comments below.

I think the original problem was just easier, those variations around 0.5 were hard to pick up with the small data set. I added more data and fixed the random seed so the results are better.

Ow ok, thanks, that's good to know! You can even write a quick line about that in the NB if you feel like it -- always nice to highlight where a model could fail 🙂

Regarding the tests: this has been fixed and merged, so if you merge master onto your branch, tests should pass now 😉

@review-notebook-app
Copy link

review-notebook-app bot commented Jun 24, 2020

View / edit / reply to this conversation on ReviewNB

AlexAndorra commented on 2020-06-24T09:19:01Z
----------------------------------------------------------------

I don't think you need to reset the seed here, at it's done at the top of the NB


bwengals commented on 2020-06-24T21:26:18Z
----------------------------------------------------------------

good call, will fix and rerun it

@review-notebook-app
Copy link

review-notebook-app bot commented Jun 24, 2020

View / edit / reply to this conversation on ReviewNB

AlexAndorra commented on 2020-06-24T09:19:02Z
----------------------------------------------------------------

I don't think you need to reset the seed here, at it's done at the top of the NB


bwengals commented on 2020-06-24T21:28:05Z
----------------------------------------------------------------

I reset it here because it's generating a new batch of fake data, it got a little confusing if I ran a few other cells before the new example. Will add a note explaining this

@review-notebook-app
Copy link

review-notebook-app bot commented Jun 24, 2020

View / edit / reply to this conversation on ReviewNB

AlexAndorra commented on 2020-06-24T09:19:03Z
----------------------------------------------------------------

I think you need plt.legend() to display the legend


bwengals commented on 2020-06-24T21:31:12Z
----------------------------------------------------------------

fixed

Copy link
Contributor Author

good call, will fix and rerun it


View entire conversation on ReviewNB

Copy link
Contributor Author

I reset it here because it's generating a new batch of fake data, it got a little confusing if I ran a few other cells before the new example. Will add a note explaining this


View entire conversation on ReviewNB

Copy link
Contributor Author

fixed


View entire conversation on ReviewNB

Copy link
Contributor

@AlexAndorra AlexAndorra left a comment

Choose a reason for hiding this comment

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

Thanks @bwengals, this looks great now!
Just run black_nbconvert again (the new cells are not formatted) and merge master in your branch so that the tests pass, and then we're good to go 🎉

@michaelosthege
Copy link
Member

@bwengals to fix the failing test:

git checkout master
git pull
git checkout gp-latent-nb-style-update
git merge master

@bwengals
Copy link
Contributor Author

thanks @michaelosthege, much appreciated, pushed

Should I keep going with this PR for the other GP notebooks? Or is 1 PR / 1 Notebook better?

@michaelosthege
Copy link
Member

thanks @michaelosthege, much appreciated, pushed

Should I keep going with this PR for the other GP notebooks? Or is 1 PR / 1 Notebook better?

I think multiple related NBs per PR are fine, but as this is done, let's merge it already

@bwengals
Copy link
Contributor Author

@AlexAndorra whoops forgot about black again!

OK that sounds good, next one I'll bundle the other GP NBs together.

@AlexAndorra AlexAndorra merged commit f93b5e7 into master Jun 26, 2020
@AlexAndorra AlexAndorra deleted the gp-latent-nb-style-update branch June 26, 2020 09:02
gmingas added a commit to alan-turing-institute/pymc3 that referenced this pull request Jul 22, 2020
* Update GP NBs to use standard notebook style (pymc-devs#3978)

* update gp-latent nb to use arviz

* rerun, run black

* rerun after fixes from comments

* rerun black

* rewrite radon notebook using ArviZ and xarray (pymc-devs#3963)

* rewrite radon notebook using ArviZ and xarray

Roughly half notebook has been updated

* add comments on xarray usage

* rewrite 2n half of notebook

* minor fix

* rerun notebook and minor changes

* rerun notebook on pymc3.9.2 and ArviZ 0.9.0

* remove unused import

* add change to release notes

* SMC: refactor, speed-up and run multiple chains in parallel for diagnostics (pymc-devs#3981)

* first attempt to vectorize smc kernel

* add ess, remove multiprocessing

* run multiple chains

* remove unused imports

* add more info to report

* minor fix

* test log

* fix type_num error

* remove unused imports update BF notebook

* update notebook with diagnostics

* update notebooks

* update notebook

* update notebook

* Honor discard_tuned_samples during KeyboardInterrupt (pymc-devs#3785)

* Honor discard_tuned_samples during KeyboardInterrupt

* Do not compute convergence checks without samples

* Add time values as sampler stats for NUTS (pymc-devs#3986)

* Add time values as sampler stats for NUTS

* Use float time counters for nuts stats

* Add timing sampler stats to release notes

* Improve doc of time related sampler stats

Co-authored-by: Alexandre ANDORRA <andorra.alexandre@gmail.com>

Co-authored-by: Alexandre ANDORRA <andorra.alexandre@gmail.com>

* Drop support for py3.6 (pymc-devs#3992)

* Drop support for py3.6

* Update RELEASE-NOTES.md

Co-authored-by: Colin <ColCarroll@users.noreply.github.com>

Co-authored-by: Colin <ColCarroll@users.noreply.github.com>

* Fix Mixture distribution mode computation and logp dimensions

Closes pymc-devs#3994.

* Add more info to divergence warnings (pymc-devs#3990)

* Add more info to divergence warnings

* Add dataclasses as requirement for py3.6

* Fix tests for extra divergence info

* Remove py3.6 requirements

* follow-up of py36 drop (pymc-devs#3998)

* Revert "Drop support for py3.6 (pymc-devs#3992)"

This reverts commit 1bf867e.

* Update README.rst

* Update setup.py

* Update requirements.txt

* Update requirements.txt

Co-authored-by: Adrian Seyboldt <aseyboldt@users.noreply.github.com>

* Show pickling issues in notebook on windows (pymc-devs#3991)

* Merge close remote connection

* Manually pickle step method in multiprocess sampling

* Fix tests for extra divergence info

* Add test for remote process crash

* Better formatting in test_parallel_sampling

Co-authored-by: Junpeng Lao <junpenglao@gmail.com>

* Use mp_ctx forkserver on MacOS

* Add test for pickle with dill

Co-authored-by: Junpeng Lao <junpenglao@gmail.com>

* Fix keep_size for arviz structures. (pymc-devs#4006)

* Fix posterior pred. sampling keep_size w/ arviz input.

Previously posterior predictive sampling functions did not properly
handle the `keep_size` keyword argument when getting an xarray Dataset
as parameter.

Also extended these functions to accept InferenceData object as input.

* Reformatting.

* Check type errors.

Make errors consistent across sample_posterior_predictive and fast_sample_posterior_predictive, and add 2 tests.

* Add changelog entry.

Co-authored-by: Robert P. Goldman <rpgoldman@sift.net>

* SMC-ABC add distance, refactor and update notebook (pymc-devs#3996)

* update notebook

* move dist functions out of simulator class

* fix docstring

* add warning and test for automatic selection of sort sum_stat when using wassertein and energy distances

* update release notes

* fix typo

* add sim_data test

* update and add tests

* update and add tests

* add docs for interpretation of length scales in periodic kernel (pymc-devs#3989)

* fix the expression of periodic kernel

* revert change and add doc

* FIXUP: add suggested doc string

* FIXUP: revertchanges in .gitignore

* Fix Matplotlib type error for tests (pymc-devs#4023)

* Fix for issue 4022.

Check for support for `warn` argument in `matplotlib.use()` call. Drop it if it causes an error.

* Alternative fix.

* Switch from pm.DensityDist to pm.Potential to describe the likelihood in MLDA notebooks and script examples. This is done because of the bug described in arviz-devs/arviz#1279. The commit also changes a few parameters in the MLDA .py example to match the ones in the equivalent notebook.

* Remove Dirichlet distribution type restrictions (pymc-devs#4000)

* Remove Dirichlet distribution type restrictions

Closes pymc-devs#3999.

* Add missing Dirichlet shape parameters to tests

* Remove Dirichlet positive concentration parameter constructor tests

This test can't be performed in the constructor if we're allowing Theano-type
distribution parameters.

* Add a hack to statically infer Dirichlet argument shapes

Co-authored-by: Brandon T. Willard <brandonwillard@users.noreply.github.com>

Co-authored-by: Bill Engels <w.j.engels@gmail.com>
Co-authored-by: Oriol Abril-Pla <oriol.abril.pla@gmail.com>
Co-authored-by: Osvaldo Martin <aloctavodia@gmail.com>
Co-authored-by: Adrian Seyboldt <aseyboldt@users.noreply.github.com>
Co-authored-by: Alexandre ANDORRA <andorra.alexandre@gmail.com>
Co-authored-by: Colin <ColCarroll@users.noreply.github.com>
Co-authored-by: Brandon T. Willard <brandonwillard@users.noreply.github.com>
Co-authored-by: Junpeng Lao <junpenglao@gmail.com>
Co-authored-by: rpgoldman <rpgoldman@goldman-tribe.org>
Co-authored-by: Robert P. Goldman <rpgoldman@sift.net>
Co-authored-by: Tirth Patel <tirthasheshpatel@gmail.com>
Co-authored-by: Brandon T. Willard <971601+brandonwillard@users.noreply.github.com>
@kyleabeauchamp kyleabeauchamp added this to the 3.9.3 milestone Jul 28, 2020
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.

4 participants