pyriemann.utils.mean.mean_riemann

pyriemann.utils.mean.mean_riemann(covmats, tol=1e-08, maxiter=50, init=None, sample_weight=None)[source]

Return the mean covariance matrix according to the Riemannian metric.

The procedure is similar to a gradient descent minimizing the sum of riemannian distance to the mean.

\[\mathbf{C} = \arg\min{(\sum_i \delta_R ( \mathbf{C} , \mathbf{C}_i)^2)}\]
Parameters:
  • covmats – Covariance matrices set, Ntrials X Nchannels X Nchannels
  • tol – the tolerance to stop the gradient descent
  • maxiter – The maximum number of iteration, default 50
  • init – A covariance matrix used to initialize the gradient descent. If None the Arithmetic mean is used
  • sample_weight – the weight of each sample
Returns:

the mean covariance matrix