pyriemann.utils.mean.mean_logdet

pyriemann.utils.mean.mean_logdet(covmats, tol=0.0001, maxiter=50, init=None, sample_weight=None)

Mean of SPD/HPD matrices according to the log-det metric.

Log-det mean is obtained by an iterative procedure where the update is:

\[\mathbf{C} = \left( \sum_i w_i \ \left( 0.5 \mathbf{C} + 0.5 \mathbf{X}_i \right)^{-1} \right)^{-1}\]
Parameters:
covmatsndarray, shape (n_matrices, n, n)

Set of SPD/HPD matrices.

tolfloat, default=10e-5

The tolerance to stop the gradient descent.

maxiterint, default=50

The maximum number of iterations.

initNone | ndarray, shape (n, n), default=None

A SPD/HPD matrix used to initialize the gradient descent. If None, the weighted Euclidean mean is used.

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

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

Returns:
Cndarray, shape (n, n)

Log-det mean.

See also

mean_covariance