pyriemann.geometry.mean.mean_logchol

pyriemann.geometry.mean.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:
Xndarray, shape (…, n_matrices, n, n)

Set of SPD/HPD matrices.

sample_weightNone | ndarray, shape (n_matrices,), default=None

Weights for each matrix. If None, it uses equal weights.

Returns:
Mndarray, shape (…, n, n)

Log-Cholesky mean.

See also

gmean

Notes

Added in version 0.7.

Changed in version 0.12: Add support for NumPy and PyTorch.

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.