All Projects → pyRiemann → pyRiemann

pyRiemann / pyRiemann

Licence: BSD-3-Clause license
Python machine learning package based on sklearn API for multivariate data processing and statistical analysis of symmetric positive definite matrices via Riemannian geometry

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pyRiemann

python-meegkit
🔧🧠 MEEGkit: MEG & EEG processing toolkit in Python 🧠🔧
Stars: ✭ 99 (-78.94%)
Mutual labels:  signal-processing, neuroscience, eeg
antropy
AntroPy: entropy and complexity of (EEG) time-series in Python
Stars: ✭ 111 (-76.38%)
Mutual labels:  signal-processing, neuroscience, eeg
Brainflow
BrainFlow is a library intended to obtain, parse and analyze EEG, EMG, ECG and other kinds of data from biosensors
Stars: ✭ 170 (-63.83%)
Mutual labels:  signal-processing, neuroscience, eeg
Mne Cpp
MNE-CPP: A Framework for Electrophysiology
Stars: ✭ 104 (-77.87%)
Mutual labels:  signal-processing, neuroscience, eeg
Entropy
EntroPy: complexity of time-series in Python (DEPRECATED)
Stars: ✭ 142 (-69.79%)
Mutual labels:  signal-processing, neuroscience, eeg
CereLink
Blackrock Microsystems Cerebus Link for Neural Signal Processing
Stars: ✭ 33 (-92.98%)
Mutual labels:  neuroscience, eeg, brain-computer-interface
TSception
PyTorch implementation of TSception
Stars: ✭ 52 (-88.94%)
Mutual labels:  time-series, eeg
qEEG feature set
NEURAL: a neonatal EEG feature set in Matlab
Stars: ✭ 29 (-93.83%)
Mutual labels:  signal-processing, eeg
EEG-Motor-Imagery-Classification-CNNs-TensorFlow
EEG Motor Imagery Tasks Classification (by Channels) via Convolutional Neural Networks (CNNs) based on TensorFlow
Stars: ✭ 125 (-73.4%)
Mutual labels:  eeg, brain-computer-interface
Wits
A Node.js library that reads your mind with Emotiv EPOC EEG headset
Stars: ✭ 73 (-84.47%)
Mutual labels:  signal-processing, eeg
Neurotech Course
CS198-96: Intro to Neurotechnology @ UC Berkeley
Stars: ✭ 202 (-57.02%)
Mutual labels:  neuroscience, eeg
Neurokit
NeuroKit2: The Python Toolbox for Neurophysiological Signal Processing
Stars: ✭ 264 (-43.83%)
Mutual labels:  signal-processing, eeg
wv
⏰ This R package provides the tools to perform standard and robust wavelet variance analysis for time series (signal processing). Among others, aside from computing the wavelet variance and cross-covariance (classic and robust), the package provides inference tools (e.g. confidence intervals) and plotting tools allowing to perform some visual an…
Stars: ✭ 14 (-97.02%)
Mutual labels:  time-series, signal-processing
brain-monitor
A terminal app written in Node.js to monitor brain signals in real-time
Stars: ✭ 119 (-74.68%)
Mutual labels:  signal-processing, eeg
Moabb
Mother of All BCI Benchmarks
Stars: ✭ 214 (-54.47%)
Mutual labels:  neuroscience, eeg
msda
Library for multi-dimensional, multi-sensor, uni/multivariate time series data analysis, unsupervised feature selection, unsupervised deep anomaly detection, and prototype of explainable AI for anomaly detector
Stars: ✭ 80 (-82.98%)
Mutual labels:  time-series, signal-processing
Time Series Prediction
A collection of time series prediction methods: rnn, seq2seq, cnn, wavenet, transformer, unet, n-beats, gan, kalman-filter
Stars: ✭ 351 (-25.32%)
Mutual labels:  time-series, signal-processing
Fooof
Parameterizing neural power spectra into periodic & aperiodic components.
Stars: ✭ 162 (-65.53%)
Mutual labels:  neuroscience, eeg
Eegrunt
A Collection Python EEG (+ ECG) Analysis Utilities for OpenBCI and Muse
Stars: ✭ 171 (-63.62%)
Mutual labels:  neuroscience, eeg
Bci.js
📊 EEG signal processing and machine learning in JavaScript
Stars: ✭ 117 (-75.11%)
Mutual labels:  signal-processing, eeg

pyRiemann

Code PythonVersion PyPI version Build Status codecov Documentation Status DOI Downloads

pyRiemann is a Python machine learning package based on scikit-learn API. It provides a high-level interface for processing and classification of multivariate time series through the Riemannian geometry of symmetric positive definite (SPD) matrices.

pyRiemann aims at being a generic package for multivariate time series classification but has been designed around multichannel biosignals (like EEG, MEG or EMG) manipulation applied to brain-computer interface (BCI), transforming multichannel time series into covariance matrices, and classifying them using the Riemannian geometry of SPD matrices [1].

For BCI applications, studied paradigms are motor imagery [2] [3], event-related potentials (ERP) [4] and steady-state visually evoked potentials (SSVEP) [5]. Using extended labels, API allows transfer learning between sessions or subjects [6].

This code is BSD-licenced (3 clause).

Documentation

The documentation is available on http://pyriemann.readthedocs.io/en/latest/

Install

Using PyPI

pip install pyriemann

or using pip+git for the latest version of the code :

pip install git+https://github.com/pyRiemann/pyRiemann

Anaconda is not currently supported, if you want to use anaconda, you need to create a virtual environment in anaconda, activate it and use the above command to install it.

From sources

For the latest version, you can install the package from the sources using the setup.py script

python setup.py install

or in developer mode to be able to modify the sources.

python setup.py develop

How to use it

Most of the functions mimic the scikit-learn API, and therefore can be directly used with sklearn. For example, for cross-validation classification of EEG signal using the MDM algorithm described in [2], it is easy as:

import pyriemann
from sklearn.model_selection import cross_val_score

# load your data
X = ... # EEG data, in format n_epochs x n_channels x n_times
y = ... # labels

# estimate covariance matrices
cov = pyriemann.estimation.Covariances().fit_transform(X)

# cross validation
mdm = pyriemann.classification.MDM()

accuracy = cross_val_score(mdm, cov, y)

print(accuracy.mean())

You can also pipeline methods using sklearn pipeline framework. For example, to classify EEG signal using a SVM classifier in the tangent space, described in [3]:

from pyriemann.estimation import Covariances
from pyriemann.tangentspace import TangentSpace

from sklearn.pipeline import make_pipeline
from sklearn.svm import SVC
from sklearn.model_selection import cross_val_score

# load your data
X = ... # EEG data, in format n_epochs x n_channels x n_times
y = ... # labels

# build your pipeline
covest = Covariances()
ts = TangentSpace()
svc = SVC(kernel='linear')
clf = make_pipeline(covest, ts, svc)

# cross validation
accuracy = cross_val_score(clf, X, y)

print(accuracy.mean())

Check out the example folder for more examples !

Contribution Guidelines

The package aims at adopting the scikit-learn and MNE-Python conventions as much as possible. See their contribution guidelines before contributing to the repository.

Testing

If you make a modification, run the test suite before submitting a pull request

pytest

How to cite

@software{pyriemann,
  author       = {Alexandre Barachant and
                  Quentin Barthélemy and
                  Jean-Rémi King and
                  Alexandre Gramfort and
                  Sylvain Chevallier and
                  Pedro L. C. Rodrigues and
                  Emanuele Olivetti and
                  Vladislav Goncharenko and
                  Gabriel Wagner vom Berg and
                  Ghiles Reguig and
                  Arthur Lebeurrier and
                  Erik Bjäreholt and
                  Maria Sayu Yamamoto and
                  Pierre Clisson and
                  Marie-Constance Corsi},
  title        = {pyRiemann/pyRiemann: v0.3},
  month        = jul,
  year         = 2022,
  publisher    = {Zenodo},
  version      = {v0.3},
  doi          = {10.5281/zenodo.7547583},
  url          = {https://doi.org/10.5281/zenodo.7547583}
}

References

[1] M. Congedo, A. Barachant and R. Bhatia, "Riemannian geometry for EEG-based brain-computer interfaces; a primer and a review". Brain-Computer Interfaces, 4.3, pp. 155-174, 2017. link

[2] A. Barachant, S. Bonnet, M. Congedo and C. Jutten, "Multiclass Brain-Computer Interface Classification by Riemannian Geometry". IEEE Transactions on Biomedical Engineering, vol. 59, no. 4, pp. 920-928, 2012. link

[3] A. Barachant, S. Bonnet, M. Congedo and C. Jutten, "Classification of covariance matrices using a Riemannian-based kernel for BCI applications". Neurocomputing, 112, pp. 172-178, 2013. link

[4] A. Barachant and M. Congedo, "A Plug&Play P300 BCI Using Information Geometry". Research report, 2014. link

[5] EK. Kalunga, S. Chevallier, Q. Barthélemy, K. Djouani, E. Monacelli and Y. Hamam, "Online SSVEP-based BCI using Riemannian geometry". Neurocomputing, 191, pp. 55-68, 2014. link

[6] PLC. Rodrigues, C. Jutten and M. Congedo, "Riemannian Procrustes analysis: transfer learning for brain-computer interfaces". IEEE Transactions on Biomedical Engineering, vol. 66, no. 8, pp. 2390-2401, 2018. link

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].