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

Support determistic randomness. #2001

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

jesnie
Copy link
Member

@jesnie jesnie commented Oct 14, 2022

Fixes: #1956

So, we add a seed = None parameter. We use tfp.random.sanitize_seed to transform this into a random state, in a backwards-compatible manner, and then we use tensorflow.random.stateless_* function to get randomness that only depends on our random state.

This affects our likelihoods and models. This will be a breaking change for anybody who implements custom models or likelihoods, but not for people who only call existing code.

I've also added a notebook explaining how this works.

@jesnie jesnie force-pushed the jesper/1956/stateless_random branch 2 times, most recently from 8e32933 to 5dbe337 Compare October 14, 2022 15:07
@codecov
Copy link

codecov bot commented Oct 14, 2022

Codecov Report

Base: 98.09% // Head: 98.09% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (6206625) compared to base (42bd312).
Patch coverage: 92.53% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2001      +/-   ##
===========================================
- Coverage    98.09%   98.09%   -0.01%     
===========================================
  Files           93       93              
  Lines         5261     5294      +33     
===========================================
+ Hits          5161     5193      +32     
- Misses         100      101       +1     
Impacted Files Coverage Δ
gpflow/models/cglb.py 96.10% <66.66%> (ø)
gpflow/models/sgpmc.py 95.23% <77.77%> (ø)
gpflow/models/util.py 89.13% <77.77%> (ø)
gpflow/models/gpmc.py 95.74% <80.00%> (ø)
gpflow/models/training_mixins.py 95.00% <86.66%> (-2.23%) ⬇️
gpflow/models/vgp.py 97.72% <88.88%> (ø)
gpflow/models/gplvm.py 99.24% <92.30%> (+0.04%) ⬆️
...ow/conditionals/multioutput/sample_conditionals.py 100.00% <100.00%> (ø)
gpflow/conditionals/sample_conditionals.py 95.23% <100.00%> (ø)
gpflow/conditionals/util.py 100.00% <100.00%> (ø)
... and 10 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jesnie jesnie requested a review from sc336 October 17, 2022 09:13
@jesnie jesnie force-pushed the jesper/1956/stateless_random branch from 5dbe337 to ec939aa Compare October 19, 2022 09:53
@jesnie jesnie force-pushed the jesper/1956/stateless_random branch from ec939aa to 6206625 Compare October 19, 2022 10:35
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.

Use TensorFlow stateless_* random functions for more deterministic randomness
1 participant