LogNormal
DistributionLogNormal(loc: Tensor | float, scale: Tensor | float, validate_args: bool | None = None)Log-Normal distribution: where .
If a random variable has a Log-Normal distribution then its natural logarithm is Normally distributed. The probability density function is
Parameters
locTensor or floatscaleTensor or floatvalidate_argsbool or None= NoneNone.Attributes
locTensorscaleTensorNotes
The Log-Normal arises naturally whenever a quantity is the product of many independent positive factors (multiplicative growth), just as the Normal arises from additive contributions. Applications include particle-size distributions, financial asset prices, and reaction times.
Mean and variance of :
Note that both grow super-exponentially in .
Mode:
The mode is always less than the mean, reflecting right-skewness.
Examples
>>> import lucid.distributions as dist
>>> d = dist.LogNormal(loc=0.0, scale=1.0)
>>> x = d.rsample((100,))
>>> (x > 0).all() # support is strictly positive
Tensor(True)Methods (7)
__init__
→None__init__(loc: Tensor | float, scale: Tensor | float, validate_args: bool | None = None)Construct a Log-Normal distribution.
Parameters
locTensor or floatscaleTensor or floatvalidate_argsbool or None= Nonemean
→Tensormean: TensorMean of the Log-Normal distribution.
Returns
TensorShape batch_shape.
mode
→Tensormode: TensorMode of the Log-Normal distribution.
The mode is strictly less than the mean, reflecting the right-skewed nature of the distribution.
Returns
TensorShape batch_shape.
variance
→Tensorvariance: TensorVariance of the Log-Normal distribution.
Returns
TensorShape batch_shape.
rsample
→Tensorrsample(sample_shape: tuple[int, ...] = ())Draw reparameterised samples.
Samples are obtained by exponentiating Normal samples from the
underlying Normal base distribution:
Parameters
sample_shapetuple[int, ...]= ()Returns
TensorStrictly positive samples of shape
sample_shape + batch_shape.
log_prob
→Tensorlog_prob(value: Tensor)Log-probability density of the Log-Normal distribution.
By the change-of-variables formula:
where is the density of the underlying Normal distribution.
Parameters
valueTensorReturns
TensorLog-density at value.
entropy
→Tensorentropy()Shannon differential entropy of the Log-Normal distribution.
where the extra term accounts for the Jacobian of the exponential transformation.
Returns
TensorEntropy values of shape batch_shape (in nats).