spd_learn.functional.gmean#

spd_learn.functional.gmean(X, *args, metric='riemann', sample_weight=None, **kwargs)[source]#

Mean of matrices according to a metric.

Compute the mean of a set of matrices according to a metric [1].

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

  • *args (tuple) – The arguments passed to the sub function.

  • metric (string | callable, default="riemann") – Metric for mean estimation, can be: “ale”, “alm”, “bmp”, “cheap”, “chol”, “euclid”, “harmonic”, “kullback_sym”, “logchol”, “logdet”, “logeuclid”, “riemann”, “thompson”, “wasserstein”, or a callable function. If an exponent is given in args, it can be “power”, “poweuclid”.

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

  • **kwargs (dict) – The keyword arguments passed to the sub function.

Returns:

M – Mean of matrices.

Return type:

ndarray, shape (…, n, n)

Notes

Changed in version 0.11: Rename mean_covariance into gmean.

References

[1]

Review of Riemannian distances and divergences, applied to SSVEP-based BCI S. Chevallier, E. K. Kalunga, Q. Barthélemy, E. Monacelli. Neuroinformatics, Springer, 2021, 19 (1), pp.93-106