distrax icon indicating copy to clipboard operation
distrax copied to clipboard

feat(distributions): add Kumaraswamy distribution

Open Sumu004 opened this issue 5 months ago • 1 comments

What does this PR do?

Adds distrax.Kumaraswamy(concentration0, concentration1) — the Kumaraswamy distribution on the open interval (0, 1).

The Kumaraswamy distribution (Kumaraswamy 1980) has PDF f(x; a, b) = ab·x^{a-1}·(1−x^a)^{b-1} and the key property that its CDF and quantile function have closed forms, unlike the Beta distribution. This makes it well-suited for:

  • Reparameterized sampling in variational inference (no rejection sampling needed)
  • Normalizing flows where an invertible map on (0,1) is required
  • Drop-in replacement for Beta when differentiable sampling matters

Implemented

Method Formula
log_prob(x) log(ab) + (a-1)log x + (b-1)log(1-x^a)
log_cdf(x) log(1 − (1−x^a)^b)
mean() b · B(1+1/a, b) via log-gammas
variance() b · B(1+2/a, b) − mean²
mode() ((a-1)/(ab-1))^{1/a} for interior; 0/1 at boundaries
entropy() (1−1/b) − log(ab) + (1−1/a)·(γ + ψ(b+1)) (exact)
sample() Closed-form quantile: (1 − (1−u)^{1/b})^{1/a}, u ~ Uniform

Tests

20 tests in kumaraswamy_test.py — log_prob / log_cdf / mean / variance / mode / entropy all validated against TFP; sampling shape, range, and moments; JIT compatibility.

Reference

Kumaraswamy, P. (1980). A generalized probability density function for double-bounded random processes. Journal of Hydrology, 46(1–2), 79–88.

Sumu004 avatar Jun 04 '26 17:06 Sumu004

Friendly bump on this new Kumaraswamy distribution PR, open about a month with no review yet. Happy to adjust anything needed. Thanks!

Sumu004 avatar Jul 10 '26 10:07 Sumu004