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
dimint or None= NoneNone,
inferred from the trailing input dimension or matrix
shape .Notes
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.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 identityUsed by 2
Constructors
1Instance methods
3Map (..., d*(d-1)/2) to (..., d, d).
Map (..., d, d) to (..., d*(d-1)/2).
Log-Jacobian of the unconstrained-to-Cholesky correlation map.
A function of x alone: the entry at (row i, column k) of the
free vector contributes
,
the 1 from the tanh and the rest from the stick-breaking that
follows (see the note in the body).
Parameters
Returns
TensorPer-sample log-Jacobian.