pyRiemann¶
Riemannian Geometry for Machine Learning¶
Machine learning for multivariate data through the Riemannian geometry of positive definite matrices.
Get up and running with pyRiemann.
Browse the example gallery for tutorials and use cases.
Detailed documentation for all modules, classes, and functions.
Overview¶
pyRiemann is a Python package for machine learning with multivariate data, using the Riemannian geometry of symmetric (resp. Hermitian) positive definite (SPD) (resp. HPD) matrices. It provides a high-level interface fully compatible with scikit-learn, making it easy to build powerful pipelines for classification, regression, and clustering.
Key features:
Riemannian Geometry – Leverage distances, means, and tangent space projections on the manifold of SPD/HPD matrices.
scikit-learn Compatible – All estimators follow the scikit-learn API. Build pipelines, use cross-validation, and grid search out of the box.
Brain-Computer Interfaces – State-of-the-art processing and classification of EEG, MEG, and fNIRS signals.
Remote Sensing – Apply Riemannian clustering to radar image segmentation.
Transfer Learning – Domain adaptation tools for cross-session and cross-subject generalization.
NumPy and PyTorch Backends – Core geometry functions support both backends transparently through the Python Array API, enabling optional GPU acceleration and autograd when PyTorch tensors are passed in.
Example¶
Build a simple BCI classification pipeline using covariance matrices and the Minimum Distance to Mean (MDM) classifier:
from pyriemann.estimation import Covariances
from pyriemann.classification import MDM
from sklearn.pipeline import make_pipeline
pipeline = make_pipeline(
Covariances(estimator="lwf"),
MDM(metric="riemann"),
)
pipeline.fit(X_train, y_train)
print(pipeline.score(X_test, y_test))
Citing pyRiemann¶
If you use pyRiemann in a scientific publication, please cite it using the Zenodo DOI:
Barachant A., Barthélemy Q., King J., Gramfort A., Chevallier S., Rodrigues P.L.C., Olivetti E., Goncharenko V., Wagner vom Berg G., Reguig G., Lebeurrier A., Bjäreholt E., Yamamoto M.S., Clisson P., Corsi M., Carrara I., Mellot A., Junqueira Lopes B., Gaisford B., Mian A., Andreev A., Cattan G., Aristimunha B. (2026). pyRiemann (version v0.10). DOI: 10.5281/zenodo.593816 URL: https://doi.org/10.5281/zenodo.593816
BibTeX entry:
@software{pyriemann,
author = {Barachant, Alexandre and Barthélemy, Quentin and King, Jean-Rémi and Gramfort, Alexandre and Chevallier, Sylvain and Rodrigues, Pedro L. C. and Olivetti, Emanuele and Goncharenko, Vladislav and Wagner vom Berg, Gabriel and Reguig, Ghiles and Lebeurrier, Arthur and Bjäreholt, Erik and Yamamoto, Maria Sayu and Clisson, Pierre and Corsi, Marie-Constance and Carrara, Igor and Mellot, Apolline and Junqueira Lopes, Bruna and Gaisford, Brent and Mian, Ammar and Andreev, Anton and Cattan, Gregoire and Aristimunha, Bruno},
doi = {10.5281/zenodo.593816},
month = {1},
title = {pyRiemann},
url = {https://doi.org/10.5281/zenodo.593816},
year = {2026}
}