spd_learn.functional.mean_power#
- spd_learn.functional.mean_power(X, p, *, sample_weight=None, zeta=1e-09, maxiter=100, init=None)[source]#
Power mean of SPD/HPD matrices.
Power mean of order \(p\) is the solution of [1] [2]:
\[\mathbf{M} = \sum_i w_i \ \mathbf{M} \sharp_p \mathbf{X}_i\]with \(\mathbf{w}\) being the weights which sum to 1, and \(\mathbf{A} \sharp_p \mathbf{B}\) being the geodesic between matrices \(\mathbf{A}\) and \(\mathbf{B}\).
- Parameters:
X (ndarray, shape (..., n_matrices, n, n)) – Set of SPD/HPD matrices.
p (float) – Exponent, in [-1,+1]. For p=0, it returns
pyriemann.geometry.mean.mean_riemann().sample_weight (None | ndarray, shape (n_matrices,), default=None) – Weights for each matrix. If None, it uses equal weights.
zeta (float, default=10e-10) – Stopping criterion.
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 weighted power Euclidean mean is used.
- Returns:
M – Power 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
References
[1]Matrix Power means and the Karcher mean Y. Lim and M. Palfia. Journal of Functional Analysis, Volume 262, Issue 4, 15 February 2012, Pages 1498-1514.
[2]Fixed Point Algorithms for Estimating Power Means of Positive Definite Matrices M. Congedo, A. Barachant, and R. Bhatia. IEEE Transactions on Signal Processing, Volume 65, Issue 9, pp.2211-2220, May 2017