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

Proper splitting of PRNG key #526

Merged
merged 3 commits into from
May 4, 2023

Conversation

howsiyu
Copy link
Contributor

@howsiyu howsiyu commented Apr 20, 2023

No description provided.

Copy link
Member

@junpenglao junpenglao left a comment

Choose a reason for hiding this comment

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

Thanks!
Let's follow the official jax style and do:

key, *multiple_subkeys = random.split(key, num=k)

where key will get pass down to the next split while multiple_subkeys would be used in random call.

@howsiyu howsiyu force-pushed the proper-key-splitting branch from 46fa7d5 to f64fbd8 Compare April 20, 2023 07:14
@howsiyu
Copy link
Contributor Author

howsiyu commented Apr 20, 2023

Changed.

junpenglao
junpenglao previously approved these changes Apr 20, 2023
@junpenglao
Copy link
Member

There are some flaky tests - try playing around with the seed to make them past for now and leave a TODO there

@howsiyu howsiyu force-pushed the proper-key-splitting branch from cdc0ca0 to 69de189 Compare April 20, 2023 13:57
@howsiyu
Copy link
Contributor Author

howsiyu commented Apr 20, 2023

I believe the current test is just lucky to pass. In fact, I have run pytest tests/mcmc/test_sampling.py::UnivariateNormalTest in the main branch with seeds from 0 to 9 and it failed 8 out of 10 times. If we really want to merge this PR we can also just change the seed to 12 and pass the test.

@howsiyu howsiyu force-pushed the proper-key-splitting branch from 69de189 to 34cb365 Compare April 20, 2023 15:55
@codecov
Copy link

codecov bot commented Apr 21, 2023

Codecov Report

Merging #526 (a50c8ec) into main (95a92fd) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #526   +/-   ##
=======================================
  Coverage   99.28%   99.28%           
=======================================
  Files          47       47           
  Lines        1948     1948           
=======================================
  Hits         1934     1934           
  Misses         14       14           
Impacted Files Coverage Δ
blackjax/adaptation/step_size.py 100.00% <100.00%> (ø)

@junpenglao junpenglao enabled auto-merge (squash) May 4, 2023 07:01
@junpenglao junpenglao disabled auto-merge May 4, 2023 07:09
@junpenglao junpenglao enabled auto-merge (squash) May 4, 2023 07:10
Copy link
Member

@junpenglao junpenglao left a comment

Choose a reason for hiding this comment

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

Thank you!

@junpenglao junpenglao merged commit 6fb0198 into blackjax-devs:main May 4, 2023
@howsiyu howsiyu deleted the proper-key-splitting branch May 4, 2023 10:39
junpenglao added a commit that referenced this pull request Mar 12, 2024
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