spd_learn.functional.mean_logchol#
- spd_learn.functional.mean_logchol(X, sample_weight=None, **kwargs)[source]#
Mean of SPD/HPD matrices according to the log-Cholesky metric.
Log-Cholesky mean \(\mathbf{M}\) is \(\mathbf{M} = \mathbf{L} \mathbf{L}^H\), where \(\mathbf{L}\) is computed as Eq(4.3) in [1]:
\[\mathbf{L} = \sum_i w_i \text{lower}(\text{chol}(\mathbf{X}_i)) + \exp \left( \sum_i w_i \log(\text{diag}(\text{chol}(\mathbf{X}_i))) \right)\]with \(w\) being the weights which sum to 1.
- Parameters:
X (ndarray, shape (..., n_matrices, n, n)) – Set of SPD/HPD matrices.
sample_weight (None | ndarray, shape (n_matrices,), default=None) – Weights for each matrix. If None, it uses equal weights.
- Returns:
M – Log-Cholesky mean.
- Return type:
ndarray, shape (…, n, n)
Notes
Added in version 0.7.
Changed in version 0.12: Add support for NumPy and PyTorch.
See also
References
[1]Riemannian geometry of symmetric positive definite matrices via Cholesky decomposition Z. Lin. SIAM J Matrix Anal Appl, 2019, 40(4), pp. 1353-1370.