Add standard_gamma sampler#7
Merged
neerajprad merged 5 commits intopyro-ppl:masterfrom Feb 27, 2019
fehiepsi:gamma
Merged
Conversation
Member
|
#8 should take care of pytest not throwing exceptions for the warning that you see. |
neerajprad
reviewed
Feb 27, 2019
test/test_distributions.py
Outdated
| def test_standard_gamma_stats(alpha): | ||
| rng = random.PRNGKey(0) | ||
| z = standard_gamma(rng, np.full((1000,), alpha)) | ||
| assert np.abs((np.mean(z) - alpha) / alpha) < 0.06 |
Member
There was a problem hiding this comment.
nit: You could just use np.allclose with rtol=0.06.
Member
|
I think it will be a good idea to move most of the distributions related functionality to jax finally, but that will also add overhead in terms of design discussions and review. For the time being, its nice to be able to hack away without that overhead, but let us keep that in mind for sure. |
neerajprad
approved these changes
Feb 27, 2019
Member
|
Thanks for adding the gamma sampler, @fehiepsi. I'll take a look at issue 3 you mentioned above after merging this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds standard_gamma sampler. It is slow to compile but after compiling, sampling will be fast.
I think this version can be temporarily used for time being. Currently, some drawbacks are:
whilejax-ml/jax#441 (lax.while_loopcan not be used invmap).standard_gamma. I don't know how to resolve it so I make an issue here.Later, to improve performance, we should move to this to JAX to get feedback from its devs.
@neerajprad Do I need CUDA to run tests? Currently, all tests throw error that "platform CUDA not found". :(