-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add icdf functions for distributions #6612
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
Comments
Hi @michaelraczycki or anyone else reviewing this, this is my first attempt to contribute to PyMC, so please let me know if this PR makes sense. |
Hey @gokuld! Thank you for your contribution, it look promising. For the future reference please add a comment under the issue, letting others know that you're starting to work on specific issue/ parts of the issue. This assure that you're not working in parallel with someone else on the same part of the development. |
Thanks @michaelraczycki .
Sure, I will post a comment when I start work to avoid parallel duplicate work from next time! |
Hey all, I am starting work on the ICDF for the continuous beta distribution. Let me know if anyone else is working on this already. |
@gokuld if there's no comment under this issue saying that someone reserves it you don't need to ask. Just call it and it's yours :) |
@gokuld AFAICT the inverse CDF of the beta distribution doesn't have a closed form solution, so you would need an iterative algorithm which may not be trivial to write if you are not familiar with PyTensor. Ignore if you were aware of the fact ;) |
@michaelraczycki sure! Thank you. In addition I will also be implementing ICDFs for these: @ricardoV94 Yes, however I discovered this only after I started working on the ICDF function for the beta distribution. I was about to create a betaincinv function in pytensor. However I might need likely need some review of the approach / help here (especially with implementing the gradient in pytensor) and was about to open that as a draft PR. |
I'll be picking up
Cheers 😄 |
I have no immediate plans of finishing the work on the beta distribution, anyone else interested may pick it up. |
Good luck @james-2001 , and than you for your contribution @gokuld ! |
Adds ICDF (quantile) function for the laplace distribution. Source https://en.wikipedia.org/wiki/Laplace_distribution Issue pymc-devs#6612
Adds ICDF (quantile) function for the Pareto distribution. Source https://en.wikipedia.org/wiki/Pareto_distribution Issue pymc-devs#6612
Adds ICDF (quantile) function for the laplace distribution. Source https://en.wikipedia.org/wiki/Laplace_distribution Issue #6612
Adds ICDF (quantile) function for the Pareto distribution. Source https://en.wikipedia.org/wiki/Pareto_distribution Issue #6612
I will work on the LogNormal :) |
I'm tackling now:
😄 |
Update: No, I don't think it will work, because our automatic |
Thanks for the tips, I am going to work on and add to the next PR the Once I get used to this approach I can try to adapt it to the other "Halfs". |
Thanks for checking out the half-dist idea @amyoshino, you made me realize these don't work as other transforms and the automatic icdf should raise. I opened a PR for that effect: #6793 |
@ricardoV94 I'm glad I was able to help! 😄 |
I will now work on the |
It looks like the remaining ones have no closed form (not that I have found so far). I will give it a try on developing the icdf functions for the remaining ones. It might take a while but I will do my best to get used to all we need as fast as possible.
|
I will work on Binomial now. |
Hi, are there any more functions that need to be added here? |
I'm not 100% if the list is up to date, but it suggests missing distributions |
I'll work on the InverseGamma |
Description
We are looking for help to implement inverse cumulative distribution (ICDF) functions for our distributions!
How to help?
This PR should give a template on how to implement and test new icdf functions for distributions: #6528
ICDF functions allow users to get the value associated with a specific cumulative probability.
So far we've added 2 examples for continuous distribution
pymc/pymc/distributions/continuous.py
Lines 348 to 351 in 2fcce43
pymc/pymc/distributions/continuous.py
Lines 541 to 548 in 2fcce43
And an example for a discrete distribution:
pymc/pymc/distributions/discrete.py
Lines 824 to 832 in 2fcce43
Multiple sources describing the icdf function for any specific distribution can be found, you're free to choose which one is working for you. To start with I recommend checking:
E.g.: https://en.wikipedia.org/wiki/Normal_distribution
It should be called "Quantile" as on the screenshot above.
New tests have to be added in test_continuous.py for continuous distributions, and test_discrete.py for discrete ones. You can use existing tests as a template:
pymc/tests/distributions/test_continuous.py
Lines 282 to 286 in 2fcce43
Don't hesitate to ask any questions. You can grab as many distributions to implement moments as you want. Just make sure to write in this issue so that we can keep track of it.
Profit with your new open source KARMA!
The following distributions don't have an icdf method implemented:
Note that not all of the icdf equations will have closed solution, so it's recommended to first start with the ones that can be found in closed form, as they will be easier to implement and will contribute to the task further with providing other contributors with templates to understand the topic better. The list above is not final, and I'll try to update it to contain all distributions available for taking.
The text was updated successfully, but these errors were encountered: