LKJCholesky

class paddle.distribution. LKJCholesky ( dim: int = 2, concentration: float = 1.0, sample_method: Literal[onion, cvine] = 'onion' ) [source]

The LKJCholesky class represents the LKJ distribution over Cholesky factors of correlation matrices. This class implements the LKJ distribution over Cholesky factors of correlation matrices, as described in Lewandowski, Kurowicka, and Joe (2009). It supports two sampling methods: “onion” and “cvine”.

Parameters
  • dim (int) – The dimension of the correlation matrices.

  • concentration (float, optional) – The concentration parameter of the LKJ distribution. Default is 1.0.

  • sample_method (str, optional) – The sampling method to use, either “onion” or “cvine”. Default is “onion”.

Example

>>> import paddle

>>> dim = 3
>>> lkj = paddle.distribution.LKJCholesky(dim=dim)
>>> sample = lkj.sample()
>>> sample.shape
[3, 3]
property batch_shape : Sequence[int]

Returns batch shape of distribution

Returns

batch shape

Return type

Sequence[int]

entropy ( ) Tensor

entropy

The entropy of the distribution.

property event_shape : Sequence[int]

Returns event shape of distribution

Returns

event shape

Return type

Sequence[int]

kl_divergence ( other: Distribution ) Tensor [source]

kl_divergence

The KL-divergence between self distributions and other.

property mean : Tensor

Mean of distribution

prob ( value: Tensor ) Tensor

prob

Probability density/mass function evaluated at value.

Parameters

value (Tensor) – value which will be evaluated

probs ( value: Tensor ) Tensor

probs

Probability density/mass function.

Note

This method will be deprecated in the future, please use prob instead.

rsample ( shape: Sequence[int] = [] ) Tensor

rsample

reparameterized sample

property variance : Tensor

Variance of distribution

sample ( sample_shape: Sequence[int] = [] ) Tensor

sample

Generate a sample using the specified sampling method.

log_prob ( value: Tensor ) Tensor

log_prob

Compute the log probability density of the given Cholesky factor under the LKJ distribution.

Parameters

value (Tensor) – The Cholesky factor of the correlation matrix for which the log probability density is to be computed.

Returns

The log probability density of the given Cholesky factor under the LKJ distribution.

Return type

log_prob (Tensor)