Home

Awesome

This toolbox is no longer supported by its author. The code is working on the last 2015 Matlab version, but may not be compatible with future versions. Consider using pyRiemann as a (python) alternative.

Fee free to fork the toolbox and start your own support :)

Covariance Toolbox


This toolbox contain a set of matlab functions dedicated to covariance matrices estimation and manipulation. The key functions mainly focus on Riemanian geometry of SPD matrices, with distance, geodesic, tangent space and mean estimation of covariance matrices under different metrics.

This toolbox is licenced under GPLv3.

Installation

installer

List of functions

Generate SPD matrices

Distances

Estimation

Geodesic

Mean

Riemannian utils

Visualisation

Classification

Multiclass

binary classification only

Examples

Generate a set of covariance matrices and estimate the riemannian mean

% generate a wishart set of 10 5x5 covariances matrices with a degree of freedom equal to 11
COV = generate_wishart_set(5,10,11);

% estimate the Riemannian mean of this set.
C = mean_covariances(COV,'riemann')

C =

   14.4625    1.4332   -3.7638   -2.0052   14.2517
    1.4332   11.5863   -2.2292    7.7445    8.8240
   -3.7638   -2.2292   24.4896   -0.3460   -3.9808
   -2.0052    7.7445   -0.3460   12.1740    6.2503
   14.2517    8.8240   -3.9808    6.2503   37.4416

Generate a set of trials and estimate the riemannian mean

% generate a set of trials , 5 channels, 100 time sample and 1000 trials
X = randn(5,100,1000);

% covariance matrix of each trial
COV = covariances(X);

% Riemannian mean
C = mean_covariances(COV,'riemann')

C =

    0.9699    0.0012    0.0026    0.0050    0.0040
    0.0012    0.9659   -0.0037    0.0059    0.0001
    0.0026   -0.0037    0.9712   -0.0009   -0.0024
    0.0050    0.0059   -0.0009    0.9687   -0.0034
    0.0040    0.0001   -0.0024   -0.0034    0.9671

Classification

see example folder