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)Methods (9)
__init__
→None__init__(rate: Tensor | float, validate_args: bool | None = None)Construct 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)mean
→Tensormean: TensorExpected value of the Exponential distribution.
Returns
TensorMean , shape batch_shape.
Examples
>>> Exponential(rate=4.0).mean
Tensor(0.25)mode
→Tensormode: TensorMode 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
→Tensorvariance: TensorVariance of the Exponential distribution.
Returns
TensorVariance , shape batch_shape.
Examples
>>> Exponential(rate=2.0).variance
Tensor(0.25)rsample
→Tensorrsample(sample_shape: tuple[int, ...] = ())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.0log_prob
→Tensorlog_prob(value: Tensor)Log-density of value under the Exponential distribution.
Parameters
valueTensorReturns
TensorElement-wise log-densities, shape batch_shape.
Examples
>>> d = Exponential(rate=1.0)
>>> d.log_prob(lucid.tensor(1.0)) # -1.0
Tensor(-1.0)cdf
→Tensorcdf(value: Tensor)Cumulative distribution function of the Exponential distribution.
Parameters
valueTensorReturns
TensorCDF values in , shape batch_shape.
Examples
>>> Exponential(rate=1.0).cdf(lucid.tensor(1.0)) # 1 - e^-1 ≈ 0.632
Tensor(0.6321)icdf
→Tensoricdf(value: Tensor)Inverse CDF (quantile function) of the Exponential distribution.
Parameters
valueTensorReturns
TensorQuantiles in , shape batch_shape.
Examples
>>> Exponential(rate=1.0).icdf(lucid.tensor(0.5)) # log(2) ≈ 0.693
Tensor(0.6931)entropy
→Tensorentropy()Shannon 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)