scvi.distributions.Log1pNormal#

class scvi.distributions.Log1pNormal(mu, sigma, scale=None, validate_args=False)[source]#

Bases: Distribution

Log1p-Normal distribution.

Distribution where log(X + 1) follows a Normal distribution. This allows modeling data with zeros, as the support is [0, ∞).

In the (mu, sigma) parameterization, samples from the log1p-normal are generated as follows:

  1. \(z \sim \textrm{Normal}(\mu, \sigma)\)

  2. \(x = \exp(z) - 1\)

The probability density function is:

\[f(x; \mu, \sigma) = \frac{1}{(x+1) \sigma \sqrt{2\pi}} \exp\left(-\frac{(\ln(x+1) - \mu)^2}{2\sigma^2}\right)\]
Parameters:
  • mu (Tensor) – Mean of the normal distribution in log1p space.

  • sigma (Tensor) – Standard deviation of the normal distribution in log1p space.

  • scale (Tensor | None (default: None)) – Normalized mean expression of the distribution. This optional parameter is not used in any computations but allows storing normalization expression levels.

  • validate_args (bool (default: False)) – Raise ValueError if arguments do not match constraints.

Attributes table#

arg_constraints

mean

Mean of the distribution.

support

variance

Variance of the distribution.

Methods table#

get_normalized(key)

Get normalized values.

log_prob(value)

Log probability with log1p transformation.

sample([sample_shape])

Sample from the distribution.

Attributes#

Log1pNormal.arg_constraints = {'mu': Optional(Real()), 'scale': Optional(GreaterThanEq(lower_bound=0)), 'sigma': Optional(GreaterThan(lower_bound=0))}#
Log1pNormal.mean[source]#

Mean of the distribution.

Log1pNormal.support = GreaterThanEq(lower_bound=0.0)#
Log1pNormal.variance[source]#

Variance of the distribution.

Methods#

Log1pNormal.get_normalized(key)[source]#

Get normalized values.

Return type:

Tensor

Log1pNormal.log_prob(value)[source]#

Log probability with log1p transformation.

Return type:

Tensor

Log1pNormal.sample(sample_shape=None)[source]#

Sample from the distribution.

Return type:

Tensor