From 6b9c002b59a3b99be34cd3b2ff37a541ffa506c7 Mon Sep 17 00:00:00 2001 From: Gilad Turok <36947659+gil2rok@users.noreply.github.com> Date: Fri, 16 Aug 2024 05:37:18 +0000 Subject: [PATCH] Doc: Clarify Cholesky unflattening --- blackjax/vi/fullrank_vi.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blackjax/vi/fullrank_vi.py b/blackjax/vi/fullrank_vi.py index bd56932be..d65fadf85 100644 --- a/blackjax/vi/fullrank_vi.py +++ b/blackjax/vi/fullrank_vi.py @@ -145,15 +145,15 @@ def sample_fn(rng_key: PRNGKey, state: FRVIState, num_samples: int): def _unflatten_cholesky(chol_params): - """Construct the Cholesky factor from a flattened vector of cholesky parameters. + """Construct the Cholesky factor from a flattened vector of Cholesky parameters. Transforms a flattened vector representation of a lower triangular matrix into a full Cholesky factor. The input vector contains n = d(d+1)/2 elements - consisting of d diagonal elements followed by n - d off-diagonal elements in + consisting of d diagonal elements followed by n-d off-diagonal elements in row-major order, where d is the dimension of the matrix. The diagonal elements are passed through a softplus function to ensure (numerically - stable) positivity, crucial to maintain a valid covariance matrix parameterization. + stable) positivity, such that the resulting Cholesky factor is positive definite. This parameterization allows for unconstrained optimization while ensuring the resulting covariance matrix Sigma = CC^T is symmetric and positive definite.