Gumbel
DistributionGumbel(loc: Tensor | float, scale: Tensor | float, validate_args: bool | None = None)Gumbel (Type-I extreme value) distribution on .
Continuous distribution that models the maximum (or minimum) of a sample drawn from a number of distributions with exponential-like tails. It is the limiting distribution of the maximum of IID exponential-tailed variables (Fisher–Tippett–Gnedenko theorem) and is the basis of the celebrated Gumbel-max trick for differentiable sampling from categorical distributions.
Parameters
Notes
Probability density (with ):
Cumulative distribution:
Moments:
where is the Euler–Mascheroni constant. The mode is and the entropy is .
Gumbel-softmax trick: if IID and are category probabilities, then is a sample from . Replacing the argmax with a softmax yields a continuous relaxation that supports gradient flow through discrete choices (Jang et al., 2017; Maddison et al., 2017).
Examples
>>> import lucid
>>> from lucid.distributions import Gumbel
>>> d = Gumbel(loc=0.0, scale=1.0)
>>> d.rsample((4,))
Tensor([...])
>>> d.log_prob(lucid.tensor(0.0))
Tensor(-1.0)Used by 2
Constructors
1__init__
→None__init__(loc: Tensor | float, scale: Tensor | float, validate_args: bool | None = None)Properties
3μ + s · γ where γ is the Euler–Mascheroni constant.
Mode of the Gumbel distribution.
Returns
TensorThe location parameter , which coincides with the mode of the Gumbel PDF.
(π · s)² / 6.
Instance methods
3log(s) + γ + 1.
Reparameterised sample via the Gumbel icdf: μ − s · log(−log U).