You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Transforms the off-diagonal elements of a correlation matrix to
147
-
unconstrained real numbers.
146
+
Transforms unconstrained real numbers to the off-diagonal elements of
147
+
a Cholesky decomposition of a correlation matrix.
148
148
149
-
Note: This is not particular to the LKJ distribution - it is only a
150
-
transform to help generate cholesky decompositions for random valid
151
-
correlation matrices.
149
+
This ensures that the resulting correlation matrix is positive definite.
152
150
153
-
Ported from here: https://github.com/tensorflow/probability/blob/94f592af363e13391858b48f785eb4c250912904/tensorflow_probability/python/bijectors/correlation_cholesky.py#L31
151
+
#### Mathematical Details
154
152
155
-
The backward side of this transformation is the off-diagonal upper
156
-
triangular elements of a correlation matrix, specified in row major order.
153
+
[Include detailed mathematical explanations similar to the original TFP bijector.]
154
+
155
+
#### Examples
156
+
157
+
```python
158
+
transform = CholeskyCorr(n=3)
159
+
x = pt.as_tensor_variable([0.0, 0.0, 0.0])
160
+
y = transform.forward(x).eval()
161
+
# y will be the off-diagonal elements of the Cholesky factor
162
+
163
+
x_reconstructed = transform.backward(y).eval()
164
+
# x_reconstructed should closely match the original x
- Lewandowski, D., Kurowicka, D., & Joe, H. (2009). "Generating random correlation matrices based on vines and extended onion method." *Journal of Multivariate Analysis, 100*(5), 1989-2001.
157
170
"""
158
171
159
172
name="cholesky-corr"
160
173
161
-
def__init__(self, n):
174
+
def__init__(self, n, validate_args=False):
162
175
"""
176
+
Initialize the CholeskyCorr transform.
163
177
164
178
Parameters
165
179
----------
166
-
n: int
167
-
Size of correlation matrix
180
+
n : int
181
+
Size of the correlation matrix.
182
+
validate_args : bool, default False
183
+
Whether to validate input arguments.
168
184
"""
169
185
self.n=n
170
-
self.m=int(n*(n-1)/2) # number of off-diagonal elements
186
+
self.m=int(n* (n-1) /2) # Number of off-diagonal elements
0 commit comments