pymc-devs/pymc

Add icdf functions for distributions

Open

#6,612 创建于 2023年3月18日

在 GitHub 查看
 (29 评论) (4 反应) (0 负责人)Python (7,926 star) (1,902 fork)batch import
beginner friendlyhelp wanted

描述

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: https://github.com/pymc-devs/pymc/pull/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

And an example for a discrete distribution:

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:

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:

https://github.com/pymc-devs/pymc/blob/2fcce433548a411f695d684ffb2d001a82a35f20/tests/distributions/test_continuous.py#L282-L286

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:

  • Beta #6845
  • Kumaraswamy #6642
  • Exponential #6641
  • Laplace #6707
  • StudentT #6845
  • Cauchy #6747
  • HalfCauchy
  • Gamma #6845
  • HalfNormal
  • Weibull #6802
  • LogNormal #6766
  • HalfStudentT
  • Wald
  • Pareto #6707
  • InverseGamma
  • ExGaussian
  • Binomial #7362
  • BetaBinomial
  • Poisson
  • NegativeBinomial
  • DiracDelta
  • DiscreteUniform #6617
  • HyperGeometric
  • Categorical
  • CustomDist (allow user to pass one, or try to infer like we do for logp/logcdf already)
  • AsymmetricLaplace
  • SkewNormal
  • Triangular #6802
  • DiscreteWeibull
  • Gumbel #6802
  • Logistic #6747
  • LogitNormal
  • Interpolated
  • Rice
  • Moyal #6802
  • PolyaGamma
  • Mixture (requires an interative algorithm based on the logcdf, see here)

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.

贡献者指南