-
-
Notifications
You must be signed in to change notification settings - Fork 152
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
Add GenGammaRV jax implementation #1450
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried and the tests pass locally with SciPy==1.7.2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative is to add the test to test_random_RandomVariable
which uses stats.cramervonmises
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've rebased, adjusted the docstring, and increased the number of samples drawn for the Cramér–von Mises test. This should be good to merge after the tests pass.
Adding a jax implementation of
GenGammaRV
, closing #1333. Could do better with the test I've setup, but I don't thinkstats.cramervonmises
can take a namedscale
argument.Here are a few important guidelines and requirements to check before your PR can be merged:
pre-commit
is 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.