Add GenGammaRV jax implementation#1450
Conversation
tests/link/jax/test_random.py
Outdated
| ref = stats.gengamma(alpha / p, p, scale=lam) | ||
| ref.random_state = rng_state | ||
| samples_ref = ref.rvs(n_samples) | ||
| test = stats.cramervonmises_2samp(samples, samples_ref) |
There was a problem hiding this comment.
Looks like this is failing in CI because the Python 3.7 tests are using SciPy 1.61 and not > 1.7.0.
There was a problem hiding this comment.
We can probably change the SciPy lower bound to 1.7.0, because our NumPy lower bound is 1.17, and SciPy recommends a version greater than 1.7.0 for that. The only relevant SciPy constraint of which I'm aware is in numba-scipy, which currently upper-bounds SciPy at <= 1.7.3, but allows the desired 1.7.0 lower bound.
There was a problem hiding this comment.
I just tried and the tests pass locally with SciPy==1.7.2.
There was a problem hiding this comment.
The alternative is to add the test to test_random_RandomVariable which uses stats.cramervonmises.
There was a problem hiding this comment.
I didn't use stats.cramervonmises in test_random_RandomVariable as it doesn't really allow you to handle named arguments and scipy also uses a different parametrization. I'm happy to change if bumping scipy just for this is not an option
There was a problem hiding this comment.
You can use a different parametrization in the tests, look at the test for the gamma distribution for instance. Unless I misunderstood your problem?
There was a problem hiding this comment.
Nice, somehow missed that. I've pushed something to use test_random_RandomVariable but feels brittle to force the loc and scale arguments this way. Some details on the issue with cramervonmisses here: scipy/scipy#18055
9789ead to
f550d00
Compare
f550d00 to
1ea7b6c
Compare
brandonwillard
left a comment
There was a problem hiding this comment.
FYI: I've rebased, squashed, and fixed the formatting issue from the last CI run.
|
Sorry for the spam, rebased the wrong branch. Let me quickly fix it |
a6cafef to
7f343b3
Compare
7f343b3 to
4d777b0
Compare
Adding a jax implementation of
GenGammaRV, closing #1333. Could do better with the test I've setup, but I don't thinkstats.cramervonmisescan take a namedscaleargument.Here are a few important guidelines and requirements to check before your PR can be merged:
pre-commitis installed and set up.Don't worry, your PR doesn't need to be in perfect order to submit it. As development progresses and/or reviewers request changes, you can always rewrite the history of your feature/PR branches.
If your PR is an ongoing effort and you would like to involve us in the process, simply make it a draft PR.