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
146
-
unconstrained real numbers.
145
+
Transforms unconstrained real numbers to the off-diagonal elements of
146
+
a Cholesky decomposition of a correlation matrix.
147
147
148
-
Note: This is not particular to the LKJ distribution - it is only a
149
-
transform to help generate cholesky decompositions for random valid
150
-
correlation matrices.
148
+
This ensures that the resulting correlation matrix is positive definite.
151
149
152
-
Ported from here: https://github.com/tensorflow/probability/blob/94f592af363e13391858b48f785eb4c250912904/tensorflow_probability/python/bijectors/correlation_cholesky.py#L31
150
+
#### Mathematical Details
153
151
154
-
The backward side of this transformation is the off-diagonal upper
155
-
triangular elements of a correlation matrix, specified in row major order.
152
+
[Include detailed mathematical explanations similar to the original TFP bijector.]
153
+
154
+
#### Examples
155
+
156
+
```python
157
+
transform = CholeskyCorr(n=3)
158
+
x = pt.as_tensor_variable([0.0, 0.0, 0.0])
159
+
y = transform.forward(x).eval()
160
+
# y will be the off-diagonal elements of the Cholesky factor
161
+
162
+
x_reconstructed = transform.backward(y).eval()
163
+
# 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.
156
169
"""
157
170
158
171
name="cholesky-corr"
159
172
160
-
def__init__(self, n):
173
+
def__init__(self, n, validate_args=False):
161
174
"""
175
+
Initialize the CholeskyCorr transform.
162
176
163
177
Parameters
164
178
----------
165
-
n: int
166
-
Size of correlation matrix
179
+
n : int
180
+
Size of the correlation matrix.
181
+
validate_args : bool, default False
182
+
Whether to validate input arguments.
167
183
"""
168
184
self.n=n
169
-
self.m=int(n*(n-1)/2) # number of off-diagonal elements
185
+
self.m=int(n* (n-1) /2) # Number of off-diagonal elements
0 commit comments