spd_learn.functional.mean_logdet#

spd_learn.functional.mean_logdet(X, *, tol=0.0001, maxiter=50, init=None, sample_weight=None)[source]#

Mean of SPD/HPD matrices according to the log-det metric.

Log-det mean is obtained by an iterative procedure where the update is:

\[\mathbf{M} = \left( \sum_i w_i \ \left( 0.5 \mathbf{M} + 0.5 \mathbf{X}_i \right)^{-1} \right)^{-1}\]

with \(w\) being the weights which sum to 1.

Parameters:
  • X (ndarray, shape (..., n_matrices, n, n)) – Set of SPD/HPD matrices.

  • tol (float, default=10e-5) – Tolerance to stop the gradient descent.

  • maxiter (int, default=50) – Maximum number of iterations.

  • init (None | ndarray, shape (n, n), default=None) – A SPD/HPD matrix used to initialize the gradient descent. If None, the weighted Euclidean mean is used.

  • sample_weight (None | ndarray, shape (n_matrices,), default=None) – Weights for each matrix. If None, it uses equal weights.

Returns:

M – Log-det mean.

Return type:

ndarray, shape (…, n, n)

Notes

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

See also

gmean

References