romcomma.gsa.base.Gaussian§

class Gaussian(mean, variance, is_variance_diagonal, ordinate=<tf.Tensor: shape=(), dtype=float64, numpy=0.0>, LBunch=2)[source]§

Bases: object

Encapsulates a Gaussian pdf. For numerical stability the 2 Pi factor is not included.

Parameters:
__init__(mean, variance, is_variance_diagonal, ordinate=<tf.Tensor: shape=(), dtype=float64, numpy=0.0>, LBunch=2)[source]§

Computes the logarithm of the un-normalized gaussian probability density, and the broadcast diagonal of variance_cho. Taking the product 2 * Pi * Gaussian.det(variance_cho_diagonal) gives the normalization factor for the gaussian pdf. Batch dimensions of ordinate, mean and variance are internally broadcast to match each other. This function is used to minimize exponentiation, for efficiency and accuracy purposes, in calculating ratios of gaussian pdfs.

Parameters:
  • mean (Tensor) – Gaussian population mean. Should be of adequate rank to broadcast Ls.

  • variance (Tensor) – The Gaussian population variance. Is automatically broadcast to embrace Ns.

  • is_variance_diagonal (bool) – True if variance is an M-vector.

  • ordinate (Tensor) – The ordinate (z-value) to calculate the Gaussian density for. Should be of adequate rank to broadcast Ls. If not supplied, 0 is assumed.

  • LBunch (int) – The number of consecutive output (L) dimensions to count before inserting an N for broadcasting. Usually 2, sometimes 3.

Returns: The tensor Gaussian pdf, and the diagonal of variance_cho.

Methods

__init__(mean, variance, is_variance_diagonal)

Computes the logarithm of the un-normalized gaussian probability density, and the broadcast diagonal of variance_cho.

expand_dims(axes)

Insert dimensions at the specified axes.

Attributes

det

The sqrt of the determinant of the Gaussian covariance.

pdf

Calculate the Gaussian pdf from the output of Gaussian.

exponent

The exponent of a Gaussian pdf, \(- z^{\intercal} \Sigma^{-1} z / 2\).

cho_diag

The diagonal of the Cholesky decomposition of the Gaussian covariance.

property det: Tensor§

The sqrt of the determinant of the Gaussian covariance.

property pdf: Tensor§

Calculate the Gaussian pdf from the output of Gaussian.

expand_dims(axes)[source]§

Insert dimensions at the specified axes.

Parameters:

axes (Sequence[int]) – A sequence of dims to insert.

Return type:

Gaussian

Returns: self for chaining calls.

exponent: Tensor§

The exponent of a Gaussian pdf, \(- z^{\intercal} \Sigma^{-1} z / 2\).

cho_diag: Tensor§

The diagonal of the Cholesky decomposition of the Gaussian covariance.