pyRiemann/pyRiemann

Machine learning for multivariate data through the Riemannian geometry of positive definite matrices in Python

What it solves

pyRiemann provides a specialized machine learning toolkit for analyzing multivariate data by treating covariance matrices as points on a curved manifold (Riemannian geometry) rather than in a flat Euclidean space. This approach is particularly effective for classifying complex signals where the relationship between channels is more important than the raw values, such as in brain-computer interfaces (BCI) and remote sensing.

How it works

The library implements a scikit-learn compatible API to process real-valued symmetric positive definite (SPD) and complex-valued Hermitian positive definite (HPD) matrices. It estimates covariance matrices from multichannel time series and applies Riemannian geometry techniques to classify them. It supports both NumPy and PyTorch backends via the Python Array API, allowing for GPU acceleration and automatic differentiation (autograd) when using PyTorch tensors.

Who it’s for

It is designed for researchers and engineers working with biosignals (EEG, MEG, EMG) for brain-computer interface applications, as well as those working with hyperspectral or synthetic-aperture radar (SAR) images in remote sensing.

Highlights

  • Scikit-learn Integration: Mimics the scikit-learn API, allowing it to be used directly with tools like cross_val_score and Pipeline.
  • Hardware Acceleration: Supports GPU acceleration and autograd through PyTorch integration.
  • Versatile Applications: Specifically optimized for BCI paradigms like motor imagery, event-related potentials (ERP), and steady-state visually evoked potentials (SSVEP).
  • Transfer Learning: Includes tools for multisource transfer learning between different subjects or sessions using Riemannian Procrustes analysis.

Related

  • Project
  • Project
  • Project
  • Project
  • Project