spd_learn.functional.mean_wasserstein#

spd_learn.functional.mean_wasserstein(X, tol=1e-08, maxiter=50, init=None, sample_weight=None)[source]#

Mean of SPD/HPD matrices according to the Wasserstein metric.

Wasserstein mean [1] is implemented as the inductive mean [2], adapted to the same convergence criterion as the Riemannian mean.

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

  • tol (float, default=10e-9) – 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 – Wasserstein mean.

Return type:

ndarray, shape (…, n, n)

Notes

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

See also

gmean

References

[1]

Barycenters in the Wasserstein space M. Agueh and G. Carlier. SIAM Journal on Mathematical Analysis, 2011

[2]

Barycenter Estimation of Positive Semi-Definite Matrices with Bures-Wasserstein Distance J. Zheng, H. Huang, Y. Yi, Y. Li, S.-C. Lin, ArXiv, 2023