spd_learn.functional.maskedmean_riemann#

spd_learn.functional.maskedmean_riemann(X, masks, *, tol=1e-08, maxiter=100, init=None, sample_weight=None)[source]#

Masked Riemannian mean of SPD/HPD matrices.

Given masks defined as semi-orthogonal matrices, the masked Riemannian mean of SPD/HPD matrices is obtained with a gradient descent minimizing the sum of affine-invariant Riemannian distances between masked SPD/HPD matrices and the masked mean [1].

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

  • masks (list of n_matrices ndarray of shape (n, n_i), with different n_i, such that n_i <= n) – Masks, defined as semi-orthogonal matrices. See [1].

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

  • maxiter (int, default=100) – 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 Identity is used.

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

Returns:

M – Masked Riemannian mean.

Return type:

ndarray, shape (…, n, n)

Notes

Added in version 0.3.

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

See also

mean_riemann, gmean

References

[1] (1,2)

Geodesically-convex optimization for averaging partially observed covariance matrices F. Yger, S. Chevallier, Q. Barthélemy, and S. Sra. Asian Conference on Machine Learning (ACML), Nov 2020, Bangkok, Thailand. pp.417 - 432.