pyriemann.utils.mean.mean_alm

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

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

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

\[\mathbf{M} = X_1^{\frac{1}{2}} (X_1^{-\frac{1}{2}}X_2^{\frac{1}{2}} X_1^{-\frac{1}{2}})^{\frac{1}{2}} X_1^{\frac{1}{2}}\]

and requiring a high number of iterations. Extremely slow, due to the recursive formulation.

Parameters:
Xndarray, shape (n_matrices, n, n)

Set of SPD/HPD 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:
Mndarray, shape (n, n)

ALM mean.

See also

mean_covariance

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.