pyriemann.utils.mean.mean_alm

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

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

Ando-Li-Mathias (ALM) mean is computed recursively, generalizing from [1]:

\[\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

Tolerance to stop the gradient descent.

maxiterint, default=100

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

Added 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.