CorrCholeskyTransform
TransformCorrCholeskyTransform(dim: int)Bijection from to Cholesky factors of correlation matrices.
Maps an unconstrained vector of length to the
lower-triangular Cholesky factor of a
correlation matrix (so is positive-definite with
unit diagonal). This is the standard reparameterisation used by
Stan, by Lewandowski–Kurowicka–Joe (LKJ) priors, and by the reference
framework's correlation-matrix flow. event_dim = 2.
The construction applies tanh to the free parameters, treats each
resulting value as a partial correlation, then normalises each row
of the lower triangle so the rows of have unit 2-norm
(which forces to have unit diagonal).
Parameters
dimintNotes
Forward (row-by-row stick-breaking on the unit sphere):
Inverse:
Log Jacobian determinant (closed form from Lewandowski et al., 2009):
Combine with the lucid.distributions.relaxed.LKJCholesky
distribution (or equivalent) to learn unconstrained correlation
matrices end-to-end.
Examples
>>> import lucid
>>> from lucid.distributions.transforms import CorrCholeskyTransform
>>> T = CorrCholeskyTransform(dim=3)
>>> x = lucid.zeros(3) # d*(d-1)/2 = 3 free params
>>> L = T(x) # 3x3 lower-triangular Cholesky of identityMethods (2)
__init__
→None__init__(dim: int)Store the correlation-matrix dimension dim (must be >= 2).
log_abs_det_jacobian
→Tensorlog_abs_det_jacobian(x: Tensor, y: Tensor)Log-Jacobian of the unconstrained-to-Cholesky correlation map.
Combines the tanh contribution
with the closed-form Lewandowski normalisation terms expressed
directly from the output diagonal entries of y.