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 use_with_numpyro.ipynb #165

Merged
merged 3 commits into from
Feb 3, 2022
Merged

Update use_with_numpyro.ipynb #165

merged 3 commits into from
Feb 3, 2022

Conversation

junpenglao
Copy link
Member

Update notebook to get the same diagnostic information from both numpyro and blackjax NUTS, and also setting some parameters to be the same.

This also help benchmarking as now both sampler ran in the same parameter setting.

Update notebook to get the same diagnostic information from both numpyro and blackjax NUTS, and also setting some parameters to be the same.

This also help benchmarking as now both sampler ran in the same parameter setting.
@junpenglao
Copy link
Member Author

junpenglao commented Feb 3, 2022

To use this notebook as simple benchmark, i first set the flag in the notebook RUN_BENCHMARK = True, then from terminal:

(blackjax) junpenglao-macbookpro% ipython examples/use_with_numpyro.ipynb

Benchmark with 1000 warmup steps and 5000000 sampling steps.

Blackjax:
-> Running warmup.
CPU times: user 3.06 s, sys: 48.9 ms, total: 3.11 s
Wall time: 3.12 s
-> Running sampling.
CPU times: user 29.8 s, sys: 673 ms, total: 30.4 s
Wall time: 30.1 s

Acceptance rate: 0.87
0.04% divergent transitions

Numpyro:
-> Running warmup+sampling.
CPU times: user 30.9 s, sys: 500 ms, total: 31.4 s
Wall time: 30.9 s

Acceptance rate: 0.90
0.00% divergent transitions

Blackjax average 12.08 leapfrog per iteration.
Numpyro average 10.86 leapfrog per iteration.

@codecov
Copy link

codecov bot commented Feb 3, 2022

Codecov Report

Merging #165 (ceccdf8) into main (70e6b19) will not change coverage.
The diff coverage is n/a.

❗ Current head ceccdf8 differs from pull request most recent head 58e46eb. Consider uploading reports for the commit 58e46eb to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #165   +/-   ##
=======================================
  Coverage   98.56%   98.56%           
=======================================
  Files          25       25           
  Lines         973      973           
=======================================
  Hits          959      959           
  Misses         14       14           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 70e6b19...58e46eb. Read the comment docs.

@rlouf
Copy link
Member

rlouf commented Feb 3, 2022

Clearly the window adaptation is not optimal, cf #44. But we can already see blackjax is faster / gradient evaluation :)

@rlouf rlouf merged commit 8a7ccf7 into blackjax-devs:main Feb 3, 2022
@junpenglao junpenglao deleted the update_notebook branch February 3, 2022 15:14
junpenglao added a commit that referenced this pull request Mar 12, 2024
* Update use_with_numpyro.ipynb

Update notebook to get the same diagnostic information from both numpyro and blackjax NUTS, and also setting some parameters to be the same.
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.

2 participants