class

Kumaraswamy

extendsDistribution
Kumaraswamy(concentration1: Tensor | float, concentration0: Tensor | float, validate_args: bool | None = None)
source

Kumaraswamy distribution on (0,1)(0, 1).

Two-parameter continuous distribution on the unit interval that mimics the shapes of the lucid.distributions.Beta distribution but has a closed-form CDF and inverse CDF. This makes it a popular choice in variational autoencoders and normalising flows where cheap, exact reparameterised sampling is needed and no special functions are required.

Parameters

concentration1Tensor or float
First shape parameter a>0a > 0.
concentration0Tensor or float
Second shape parameter b>0b > 0.
validate_argsbool= None
If True, validate parameter constraints at construction time.

Notes

Probability density on x(0,1)x \in (0, 1):

p(x;a,b)=abxa1(1xa)b1p(x; a, b) = a\, b\, x^{a - 1} (1 - x^a)^{b - 1}

Cumulative distribution (closed form):

F(x;a,b)=1(1xa)bF(x; a, b) = 1 - (1 - x^a)^b

Inverse CDF (used by rsample):

F1(u;a,b)=(1(1u)1/b)1/aF^{-1}(u; a, b) = (1 - (1 - u)^{1/b})^{1/a}

Moments are expressible in closed form via the Beta function:

E[Xn]=bB(1+n/a,b)\mathbb{E}[X^n] = b\, B(1 + n/a,\, b)

Special cases:

  • a=1a = 1Beta(1,b)\mathrm{Beta}(1, b)
  • b=1b = 1Beta(a,1)\mathrm{Beta}(a, 1)

Unlike Beta, Kumaraswamy is not a member of the exponential family and lacks an analytic normalising integral for sums. Its main advantage is the lack of any reliance on the gamma function in forward or backward passes.

Examples

>>> import lucid
>>> from lucid.distributions import Kumaraswamy
>>> d = Kumaraswamy(concentration1=2.0, concentration0=5.0)
>>> d.rsample((4,))
Tensor([...])
>>> d.log_prob(lucid.tensor(0.3))
Tensor(...)

Methods (6)

dunder

__init__

None
__init__(concentration1: Tensor | float, concentration0: Tensor | float, validate_args: bool | None = None)
source

Initialise a Kumaraswamy distribution.

Parameters

concentration1Tensor | float
First shape parameter a>0a > 0 (controls the left tail).
concentration0Tensor | float
Second shape parameter b>0b > 0 (controls the right tail).
validate_argsbool | None= None
If True, validate parameter constraints at construction time.
prop

mean

Tensor
mean: Tensor
source

E[X] = b · B(1 + 1/a, b) expressed via lgamma.

prop

variance

Tensor
variance: Tensor
source

Var[X] = E[X²] − E[X]² where E[X²] = b · B(1 + 2/a, b).

fn

rsample

Tensor
rsample(sample_shape: tuple[int, ...] = ())
source

Reparameterised sample via the icdf: x = (1 − (1 − U)^(1/b))^(1/a).

fn

log_prob

Tensor
log_prob(value: Tensor)
source

Log-probability density of the Kumaraswamy distribution.

Parameters

valueTensor
Point(s) x(0,1)x \in (0, 1) at which to evaluate the density.

Returns

Tensor

Log-density loga+logb+(a1)logx+(b1)log(1xa)\log a + \log b + (a-1)\log x + (b-1)\log(1-x^a).

fn

entropy

Tensor
entropy()
source

Entropy via the Beta-distributed auxiliary variable Y = X^a.

If X ~ Kumaraswamy(a, b) then Y = X^a ~ Beta(1, b), giving: E[log X] = (1/a)(ψ(1) − ψ(b+1)) = −(1/a)(γ + ψ(b+1)) E[log(1−X^a)] = ψ(b) − ψ(b+1) = −1/b

H = −log a − log b − (a−1)·E[log X] − (b−1)·E[log(1−X^a)] = −log a − log b + (1 − 1/a)(γ + ψ(b+1)) + (1 − 1/b)