8000 [FR] Support for scipy.special.gammaincinv · Issue #5350 · jax-ml/jax · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[FR] Support for scipy.special.gammaincinv #5350

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

Open
fehiepsi opened this issue Jan 8, 2021 · 9 comments
Open

[FR] Support for scipy.special.gammaincinv #5350

fehiepsi opened this issue Jan 8, 2021 · 9 comments
Labels
enhancement New feature or request open Issues intentionally left open, with no schedule for next steps.

Comments

@fehiepsi
Copy link
Contributor
fehiepsi commented Jan 8, 2021

This function is useful to compute the quantile function of Gamma distribution and many related distributions.

I know that it is pretty complicated to implement this function, but raising it here in case someone is interested in this.

@Joshuaalbert
Copy link
Contributor

+1 for JAXNS

@mattjj
Copy link
Collaborator
mattjj commented Jan 12, 2021

cc @srvasude

TFP might gain this in its special function library soon. @fehiepsi and @Joshuaalbert: would you be happy with getting this function from TFP (i.e. and depending on TFP, which does not mean depending on TF), or would you need it in JAX itself?

(In general, TFP is adding and maintaining a lot of special functions related to Bayesian inference, and so it might make sense to depend on TFP if possible so as to avoid redundant code between TFP and JAX. But I'd like to hear from you folks to see if that would work for you!)

@fehiepsi
Copy link
Contributor Author

Hi @mattjj, having this function works in tfp would be sufficient in my usage case: which is a jaxns wrapper (which requires tfp as a dependency) for numpyro models.

@mattjj mattjj removed their assignment Jan 27, 2021
@mattjj
Copy link
Collaborator
mattjj commented Jan 27, 2021

I think we're now waiting for TFP to gain this capability. @srvasude it'd be great if you could let us know on this issue when that happens!

@mattjj mattjj added the enhancement New feature or request label Jan 27, 2021
@srvasude
Copy link
Contributor

Hi all,
I've just added tfp.math.igammainv and tfp.math.igammacinv. Let me know if those works for you. I'm also planning on plumbing those as quantiles for some of our distributions, so if you are using TFP, you should just be able to call quantile.

@fehiepsi
Copy link
Contributor Author

Awesome, thanks a lot, @srvasude!

@srvasude
Copy link
Contributor

These are also plumbed through as quantile functions.

FWIW, I would be interested on how you use these (along with jaxns) :).

@Joshuaalbert
Copy link
Contributor

Hi @srvasude thanks for the work. In JAXNS we represent all RVs as quantile transformations of a U[0,1] RV. There are several RVs that are currently dependent on inverse incomplete gamma. It would be best if this was as fast as possible, ideally an XLA op. But with TFP we should be able to make do.

RE: using TFP for other probability related functions. I support this effort, as it will cause a larger community to test and improve TFP and therefore ultimately the entire community's code. While JAXNS currently doesn't make use of TFP, perhaps it should as part of the next or next-next release.

@crusaderky
Copy link
Collaborator

pyscenarios needs this to calculate Student T Copula and IT Copula. Specifically, it needs scipy.stats.chi2.ppf(x, df), which can be trivially defined as 2 * scipy.special.gammaincinv(df/2, x).
It can't just use jax.random.chisquare because it uses its own uniform (0, 1) rng (Sobol) instead of JAX's builtin PRNG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request open Issues intentionally left open, with no schedule for next steps.
Projects
None yet
Development

No branches or pull requests

6 participants
0