lognormal
RL4CRN.distributions.lognormal
Multivariate log-normal distribution.
This module defines MultivariateLogNormal, a distribution obtained by
exponentiating a multivariate normal random variable:
where the exponential is applied element-wise. The parameters loc and
covariance_matrix therefore live in log-space (they parameterize \(X\),
not \(Y\)).
Change of variables
The log-density is computed via the standard Jacobian correction. For \(y \in \mathbb{R}^d_{+}\) and \(x = \log y\):
Moments
For \(X \sim \mathcal{N}(\mu, \Sigma)\) and \(Y = \exp(X)\):
Entropy
Using the transformation \(Y = \exp(X)\),
Support
Y is element-wise nonnegative; the distribution uses
constraints.independent(constraints.nonnegative, 1) as support.
MultivariateLogNormal
Bases: Distribution
Multivariate log-normal distribution implemented via a base MVN in log-space.
Parameters are specified in log-space: \(X \sim \mathcal{N}(\mu, \Sigma)\) with loc \(\mu\) covariance matrix \(\Sigma\), and samples \(Y = \exp(X)\).
| PARAMETER | DESCRIPTION |
|---|---|
loc
|
Mean vector \(\mu\) of the underlying multivariate normal in
log-space. Shape
|
covariance_matrix
|
Covariance matrix \(\Sigma\) of the underlying
multivariate normal in log-space. Shape
|
validate_args
|
Passed to
DEFAULT:
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
mvn |
The underlying
|
mean
property
Mean of the distribution.
For \(Y = \exp(X)\) with \(X \sim \mathcal{N}(\mu,\Sigma)\):
| RETURNS | DESCRIPTION |
|---|---|
|
Tensor of shape |
variance
property
Marginal variances (diagonal of the covariance of \(Y\)).
| RETURNS | DESCRIPTION |
|---|---|
|
Tensor of shape |
real_covariance_matrix
property
Covariance matrix of \(Y\) in real space.
| RETURNS | DESCRIPTION |
|---|---|
|
Tensor of shape |
sample(sample_shape=torch.Size())
Draw samples.
Samples are generated by sampling \(X \sim \mathcal{N}(\mu,\Sigma)\) and returning \(Y = \exp(X)\).
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Optional leading sample shape.
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
|
Samples of shape |
log_prob(value)
Compute log-probability of a sample.
Uses the change-of-variables identity:
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Tensor of samples
|
| RETURNS | DESCRIPTION |
|---|---|
|
Tensor of log-probabilities with shape |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
entropy()
Differential entropy of the log-normal distribution.
Using \(Y = \exp(X)\) with \(X \sim \mathcal{N}(\mu,\Sigma)\):
| RETURNS | DESCRIPTION |
|---|---|
|
Tensor of entropies with shape |