Kumaraswamy
DistributionKumaraswamy(concentration1: Tensor | float, concentration0: Tensor | float, validate_args: bool | None = None)Kumaraswamy distribution on .
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 floatconcentration0Tensor or floatvalidate_argsbool= NoneTrue, validate parameter constraints at construction time.Notes
Probability density on :
Cumulative distribution (closed form):
Inverse CDF (used by rsample):
Moments are expressible in closed form via the Beta function:
Special cases:
- →
- →
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)
__init__
→None__init__(concentration1: Tensor | float, concentration0: Tensor | float, validate_args: bool | None = None)Initialise a Kumaraswamy distribution.
Parameters
concentration1Tensor | floatconcentration0Tensor | floatvalidate_argsbool | None= NoneTrue, validate parameter constraints at construction time.mean
→Tensormean: TensorE[X] = b · B(1 + 1/a, b) expressed via lgamma.
variance
→Tensorvariance: TensorVar[X] = E[X²] − E[X]² where E[X²] = b · B(1 + 2/a, b).
rsample
→Tensorrsample(sample_shape: tuple[int, ...] = ())Reparameterised sample via the icdf:
x = (1 − (1 − U)^(1/b))^(1/a).
log_prob
→Tensorlog_prob(value: Tensor)Log-probability density of the Kumaraswamy distribution.
Parameters
valueTensorReturns
TensorLog-density .
entropy
→Tensorentropy()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)