pyriemann.utils.mean.mean_alm

pyriemann.utils.mean.mean_alm(covmats, tol=1e-14, maxiter=100, sample_weight=None)

Ando-Li-Mathias (ALM) mean of SPD matrices.

Return the geometric mean recursively [1], generalizing from:

\[\mathbf{C} = A^{\frac{1}{2}}(A^{-\frac{1}{2}}B^{\frac{1}{2}} A^{-\frac{1}{2}})^{\frac{1}{2}}A^{\frac{1}{2}}\]

and requiring a high number of iterations.

This is the adaptation of the Matlab code proposed by Dario Bini and Bruno Iannazzo, http://bezout.dm.unipi.it/software/mmtoolbox/ . Extremely slow, due to the recursive formulation.

Parameters
covmatsndarray, shape (n_matrices, n_channels, n_channels)

Set of SPD matrices.

tolfloat, default=10e-14

The tolerance to stop the gradient descent.

maxiterint, default=100

The maximum number of iterations.

sample_weightNone | ndarray, shape (n_matrices,), default=None

Weights for each matrix. If None, it uses equal weights.

Returns
Cndarray, shape (n_channels, n_channels)

ALM mean.

Notes

New in version 0.3.

References

1

Geometric Means T. Ando, C.-K. Li, and R. Mathias. Linear Algebra and its Applications. Volume 385, July 2004, Pages 305-334.