Exponential
ExponentialFamilyExponential(rate: Tensor | float, validate_args: bool | None = None)Exponential distribution on .
Continuous distribution describing the waiting time between events of
a Poisson process with rate . It is the continuous
analogue of the lucid.distributions.Geometric distribution
and the unique continuous distribution with the memoryless property.
Parameters
rateTensor or floatvalidate_argsbool= NoneTrue, validate parameter constraints at construction time.Notes
Probability density on :
Moments:
Memoryless property:
Special cases / relations:
- The sum of IID variables is (Erlang).
- with
is the inverse-CDF sampler used by
rsample.
Examples
>>> import lucid
>>> from lucid.distributions import Exponential
>>> d = Exponential(rate=2.0)
>>> d.mean # 1/rate
Tensor(0.5)
>>> d.rsample((4,))
Tensor([...])
>>> d.log_prob(lucid.tensor(1.0))
Tensor(-1.3069)Used by 2
Constructors
1Construct an Exponential distribution.
Parameters
rateTensor | floatvalidate_argsbool | None= NoneTrue, validate parameter constraints at construction time.Notes
The Exponential distribution with rate has PDF:
It is the continuous analogue of the Geometric distribution and describes the waiting time between events in a Poisson process.
Examples
>>> from lucid.distributions import Exponential
>>> d = Exponential(rate=2.0)
>>> d.mean # 1/rate = 0.5
Tensor(0.5)Properties
3Expected value of the Exponential distribution.
Returns
TensorMean , shape batch_shape.
Examples
>>> Exponential(rate=4.0).mean
Tensor(0.25)Mode of the Exponential distribution.
The Exponential distribution is monotonically decreasing on , so the mode is always zero regardless of the rate parameter.
Returns
TensorZero tensor of shape batch_shape.
Examples
>>> Exponential(rate=5.0).mode
Tensor(0.0)Variance of the Exponential distribution.
Returns
TensorVariance , shape batch_shape.
Examples
>>> Exponential(rate=2.0).variance
Tensor(0.25)Instance methods
5Shannon entropy of the Exponential distribution (in nats).
The entropy decreases as the rate increases (concentrated distributions have lower uncertainty).
Returns
TensorEntropy in nats, shape batch_shape.
Examples
>>> Exponential(rate=1.0).entropy() # 1 - log(1) = 1.0
Tensor(1.0)Reparameterised sample via the inverse-CDF method.
Uses the transform where . This is an exact reparameterisation — gradients flow through .
Subtracting from 1 (rather than directly using ) ensures the argument to is bounded away from zero.
Parameters
sample_shapetuple[int, ...]= ()().Returns
TensorReparameterised samples of shape sample_shape + batch_shape.
Examples
>>> d = Exponential(rate=1.0)
>>> x = d.rsample((500,))
>>> x.mean() # approximately 1.0