{"id":20330869,"url":"https://github.com/pyriemann/pyriemann","last_synced_at":"2026-01-06T09:16:38.976Z","repository":{"id":30657755,"uuid":"34213430","full_name":"pyRiemann/pyRiemann","owner":"pyRiemann","description":"Machine learning for multivariate data through the Riemannian geometry of positive definite matrices in Python","archived":false,"fork":false,"pushed_at":"2025-04-17T11:29:01.000Z","size":1452,"stargazers_count":678,"open_issues_count":5,"forks_count":168,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-05-01T23:35:17.291Z","etag":null,"topics":["brain-computer-interface","covariance-estimation","covariance-matrix","eeg","hermitian-matrices","image-processing","machine-learning","positive-definite-matrices","python","radar-image","remote-sensing","riemannian-geometry","signal-processing","statistics","symmetric-matrices","time-series"],"latest_commit_sha":null,"homepage":"https://pyriemann.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyRiemann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-04-19T16:01:44.000Z","updated_at":"2025-05-01T01:41:22.000Z","dependencies_parsed_at":"2023-01-14T17:24:52.949Z","dependency_job_id":"14a04889-0c03-4d09-b646-7b90a24ea6bc","html_url":"https://github.com/pyRiemann/pyRiemann","commit_stats":{"total_commits":480,"total_committers":31,"mean_commits":"15.483870967741936","dds":0.4833333333333333,"last_synced_commit":"9ab58edf009bbcbdace83cadce9459d174a746af"},"previous_names":["alexandrebarachant/pyriemann"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyRiemann%2FpyRiemann","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyRiemann%2FpyRiemann/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyRiemann%2FpyRiemann/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyRiemann%2FpyRiemann/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyRiemann","download_url":"https://codeload.github.com/pyRiemann/pyRiemann/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254059512,"owners_count":22007769,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["brain-computer-interface","covariance-estimation","covariance-matrix","eeg","hermitian-matrices","image-processing","machine-learning","positive-definite-matrices","python","radar-image","remote-sensing","riemannian-geometry","signal-processing","statistics","symmetric-matrices","time-series"],"created_at":"2024-11-14T20:17:54.661Z","updated_at":"2026-01-06T09:16:38.971Z","avatar_url":"https://github.com/pyRiemann.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyRiemann\n\n[![Code PythonVersion](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue)](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue)\n[![PyPI version](https://badge.fury.io/py/pyriemann.svg)](https://badge.fury.io/py/pyriemann)\n[![Build Status](https://github.com/pyRiemann/pyRiemann/actions/workflows/testing.yml/badge.svg?branch=master\u0026event=push)](https://github.com/pyRiemann/pyRiemann/actions)\n[![codecov](https://codecov.io/gh/pyRiemann/pyRiemann/branch/master/graph/badge.svg)](https://codecov.io/gh/pyRiemann/pyRiemann)\n[![Documentation Status](https://readthedocs.org/projects/pyriemann/badge/?version=latest)](http://pyriemann.readthedocs.io/en/latest/?badge=latest)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.593816.svg)](https://doi.org/10.5281/zenodo.593816)\n[![Downloads](https://pepy.tech/badge/pot)](https://pepy.tech/project/pyriemann)\n\npyRiemann is a Python machine learning package based on [scikit-learn](http://scikit-learn.org/stable/modules/classes.html) API.\nIt provides a high-level interface for processing and classification of real (*resp*. complex)-valued multivariate data\nthrough the [Riemannian geometry](https://en.wikipedia.org/wiki/Riemannian_geometry) of symmetric (*resp*. Hermitian)\n[positive definite](https://en.wikipedia.org/wiki/Definite_matrix) (SPD) (*resp*. HPD) matrices.\n\nThe documentation is available on http://pyriemann.readthedocs.io/en/latest/\n\nThis code is BSD-licensed (3 clause).\n\n# Description\n\npyRiemann aims at being a generic package for multivariate data analysis\nbut has been designed around [biosignals](https://en.wikipedia.org/wiki/Biosignal) (like EEG, MEG or EMG)\nmanipulation applied to [brain-computer interface](https://en.wikipedia.org/wiki/Brain%E2%80%93computer_interface) (BCI),\nestimating [covariance matrices](https://en.wikipedia.org/wiki/Covariance_matrix) from multichannel time series,\nand classifying them using the Riemannian geometry of SPD matrices [[1]](#1).\n\nFor BCI applications, studied paradigms are motor imagery [[2]](#2) [[3]](#3),\nevent-related potentials (ERP) [[4]](#4) and steady-state visually evoked potentials (SSVEP) [[5]](#5).\nUsing extended labels, API allows multisource [transfer learning](https://en.wikipedia.org/wiki/Transfer_learning)\nbetween sessions or subjects [[6]](#6).\n\nAnother application is [remote sensing](https://en.wikipedia.org/wiki/Remote_sensing),\nestimating covariance matrices over spatial coordinates of radar images using a sliding window,\nand processing them using the Riemannian geometry of\nSPD matrices for [hyperspectral](https://en.wikipedia.org/wiki/Hyperspectral_imaging) images,\nor HPD matrices for [synthetic-aperture radar](https://en.wikipedia.org/wiki/Synthetic-aperture_radar) (SAR) images.\n\n# Installation\n\n#### Using PyPI\n\n```\npip install pyriemann\n```\nor using pip+git for the latest version of the code:\n\n```\npip install git+https://github.com/pyRiemann/pyRiemann\n```\n\n#### Using conda\n\nThe package is distributed via [conda-forge](https://conda-forge.org).\nYou could install it in your working environment, with the following command:\n\n```shell\nconda install -c conda-forge pyriemann\n```\n\n#### From sources\n\nFor the latest version, you can install the package from the sources using ``pip``:\n\n```shell\npip install .\n```\n\nor in editable mode to be able to modify the sources:\n\n```shell\npip install -e .\n```\n\n# How to use\n\nMost of the functions mimic the scikit-learn API, and therefore can be directly used with sklearn.\nFor example, for cross-validation classification of EEG signal using the MDM algorithm described in [[2]](#2), it is easy as:\n\n```python\nimport pyriemann\nfrom sklearn.model_selection import cross_val_score\n\n# load your data\nX = ... # EEG data, in format n_epochs x n_channels x n_times\ny = ... # labels\n\n# estimate covariance matrices\ncov = pyriemann.estimation.Covariances().fit_transform(X)\n\n# build your classifier\nmdm = pyriemann.classification.MDM()\n\n# cross validation\naccuracy = cross_val_score(mdm, cov, y)\n\nprint(accuracy.mean())\n\n```\n\nYou can also pipeline methods using sklearn pipeline framework.\nFor example, to classify EEG signal using a SVM classifier in the tangent space, described in [[3]](#3):\n\n```python\nfrom pyriemann.estimation import Covariances\nfrom pyriemann.tangentspace import TangentSpace\nfrom sklearn.pipeline import make_pipeline\nfrom sklearn.model_selection import cross_val_score\nfrom sklearn.svm import SVC\n\n# load your data\nX = ... # EEG data, in format n_epochs x n_channels x n_times\ny = ... # labels\n\n# build your pipeline\nclf = make_pipeline(\n    Covariances(),\n    TangentSpace(),\n    SVC(kernel=\"linear\"),\n)\n\n# cross validation\naccuracy = cross_val_score(clf, X, y)\n\nprint(accuracy.mean())\n\n```\n\nCheck out the example folder for more examples.\n\n# Contribution Guidelines\n\nThe package aims at adopting the [scikit-learn](http://scikit-learn.org/stable/developers/contributing.html#contributing-code)\nand [MNE-Python](https://mne.tools/stable/install/contributing.html) conventions as much as possible.\nSee their contribution guidelines before contributing to the repository.\n\n# Testing\n\nIf you make a modification, run the test suite before submitting a pull request\n\n```\npytest\n```\n\n# How to cite\n\n```bibtex\n@software{pyriemann,\n  author       = {Alexandre Barachant and\n                  Quentin Barthélemy and\n                  Jean-Rémi King and\n                  Alexandre Gramfort and\n                  Sylvain Chevallier and\n                  Pedro L. C. Rodrigues and\n                  Emanuele Olivetti and\n                  Vladislav Goncharenko and\n                  Gabriel Wagner vom Berg and\n                  Ghiles Reguig and\n                  Arthur Lebeurrier and\n                  Erik Bjäreholt and\n                  Maria Sayu Yamamoto and\n                  Pierre Clisson and\n                  Marie-Constance Corsi and\n                  Igor Carrara and\n                  Apolline Mellot and\n                  Bruna Junqueira Lopes and\n                  Brent Gaisford and\n                  Ammar Mian and\n                  Anton Andreev and\n                  Gregoire Cattan and\n                  Arthur Lebeurrier},\n  title        = {pyRiemann},\n  month        = jan,\n  year         = 2026,\n  version      = {v0.10},\n  publisher    = {Zenodo},\n  doi          = {10.5281/zenodo.593816},\n  url          = {https://doi.org/10.5281/zenodo.593816}\n}\n```\n\n# References\n\n\u003ca id=\"1\"\u003e[1]\u003c/a\u003e\nM. Congedo, A. Barachant and R. Bhatia, \"Riemannian geometry for EEG-based brain-computer interfaces; a primer and a review\".\nBrain-Computer Interfaces, 4.3, pp. 155-174, 2017. [link](https://hal.science/hal-01570120/document)\n\n\u003ca id=\"2\"\u003e[2]\u003c/a\u003e\nA. Barachant, S. Bonnet, M. Congedo and C. Jutten, \"Multiclass Brain-Computer Interface Classification by Riemannian Geometry\".\nIEEE Transactions on Biomedical Engineering, vol. 59, no. 4, pp. 920-928, 2012. [link](https://hal.archives-ouvertes.fr/hal-00681328)\n\n\u003ca id=\"3\"\u003e[3]\u003c/a\u003e\nA. Barachant, S. Bonnet, M. Congedo and C. Jutten, \"Classification of covariance matrices using a Riemannian-based kernel for BCI applications\".\nNeurocomputing, 112, pp. 172-178, 2013. [link](https://hal.archives-ouvertes.fr/hal-00820475/)\n\n\u003ca id=\"4\"\u003e[4]\u003c/a\u003e\nA. Barachant and M. Congedo, \"A Plug\u0026Play P300 BCI Using Information Geometry\".\nResearch report, 2014. [link](http://arxiv.org/abs/1409.0107)\n\n\u003ca id=\"5\"\u003e[5]\u003c/a\u003e\nEK. Kalunga, S. Chevallier, Q. Barthélemy, K. Djouani, E. Monacelli and Y. Hamam, \"Online SSVEP-based BCI using Riemannian geometry\".\nNeurocomputing, 191, pp. 55-68, 2014. [link](https://hal.science/hal-01351623/file/Kalunga-Chevallier-Barthelemy-Online%20SSVEP-based%20BCI%20using%20Riemannian%20Geometry-Neurocomputing-16.pdf)\n\n\u003ca id=\"6\"\u003e[6]\u003c/a\u003e\nPLC. Rodrigues, C. Jutten and M. Congedo, \"Riemannian Procrustes analysis: transfer learning for brain-computer interfaces\".\nIEEE Transactions on Biomedical Engineering, vol. 66, no. 8, pp. 2390-2401, 2018. [link](https://hal.archives-ouvertes.fr/hal-01971856)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyriemann%2Fpyriemann","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyriemann%2Fpyriemann","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyriemann%2Fpyriemann/lists"}