AsCorrelationMatrix#
- class bayesflow.adapters.transforms.AsCorrelationMatrix(*, cholesky: bool = False)[source]#
Bases:
ElementwiseTransformConstrains neural network predictions of a variable to a valid (symmetric, positive definite, unit diagonal) K x K correlation matrix, using the transforms explained by [1].
The unconstrained representation is a flat vector of K * (K - 1) / 2 entries.
- Parameters:
- choleskybool, optional
Whether the constrained side of the transform is the lower Cholesky factor, rather than the full correlation matrix. Default is False (use the full correlation matrix).
References
- [1] Lewandowski, D., Kurowicka, D., & Joe, H. (2009).
Generating random correlation matrices based on vines and extended onion method. Journal of Multivariate Analysis, 100(9), 1989-2001. https://doi.org/10.1016/j.jmva.2009.04.008
Examples
>>> adapter = bf.Adapter().as_correlation_matrix("corr_x")