Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Python for Random Matrix Theory: cleaning schemes for noisy correlation matrices

Project description

# pyRMT Python for Random Matrix Theory. Implements several cleaning schemes for noisy correlation matrices, including the optimal shrinkage, rotationally-invariant estimator to an underlying correlation matrix (as proposed by Joel Bun, Jean-Philippe Bouchaud, Marc Potters and colleagues).

Such cleaned correlation matrix are known to improve factor-decomposition via Principal Component Analysis (PCA) and could be of relevance in a variety of contexts, including computational biology.

Cleaning schemes also result in much improved out-of-sample risk of Markowitz optimal portfolios, as established over the years in several papers by Jean-Philippe Bouchaud, Marc Potters and collaborators.

Some cleaning schemes can be easily adapted from the various shrinkage estimators implemented in the sklearn.covariance module (see the various publications by O. Ledoit and M. Wolf listed below).

In addition, it might make sense to perform an empirical estimate of a correlation matrix robust to outliers before proceeding with the cleaning schemes of the present module. Some of those robust estimates have been implemented in the sklearn.covariance module as well.


  • “DISTRIBUTION OF EIGENVALUES FOR SOME SETS OF RANDOM MATRICES”, V. A. Marcenko and L. A. Pastur, Mathematics of the USSR-Sbornik, Vol. 1 (4), pp 457-483
  • “A well-conditioned estimator for large-dimensional covariance matrices”, O. Ledoit and M. Wolf, Journal of Multivariate Analysis, Vol. 88 (2), pp 365-411
  • “Improved estimation of the covariance matrix of stock returns with ” “an application to portfolio selection”, O. Ledoit and M. Wolf, Journal of Empirical Finance, Vol. 10 (5), pp 603-621
  • “Financial Applications of Random Matrix Theory: a short review”, J.-P. Bouchaud and M. Potters, arXiv: 0910.1205 [q-fin.ST]
  • “Eigenvectors of some large sample covariance matrix ensembles”, O. Ledoit and S. Peche, Probability Theory and Related Fields, Vol. 151 (1), pp 233-264
  • “NONLINEAR SHRINKAGE ESTIMATION OF LARGE-DIMENSIONAL COVARIANCE MATRICES”, O. Ledoit and M. Wolf, The Annals of Statistics, Vol. 40 (2), pp 1024-1060
  • “Rotational invariant estimator for general noisy matrices”, J. Bun, R. Allez, J.-P. Bouchaud and M. Potters, arXiv: 1502.06736 [cond-mat.stat-mech]
  • “Cleaning large Correlation Matrices: tools from Random Matrix Theory”, J. Bun, J.-P. Bouchaud and M. Potters, arXiv: 1610.08104 [cond-mat.stat-mech]

Installing from PyPI


`pip install pyRMT`

To install manually from the git repo, try this:

`python install`

The pyRMT codebase supports Python 2 and 3.


For more information on cleaning your correlation matrices, please refer to the docstrings to the various schemes implemented within pyRMT.


If you happen to use pyRMT in your work or research, please cite its GitHub repository:

  1. Giecold, pyRMT, (2017), GitHub repository,

The respective BibTex entry is

`@misc{GregoryGiecold2017, author = {G. Giecold}, title = {pyRMT}, year = {2017}, publisher = {GitHub}, journal = {GitHub repository}, howpublished = {\url{}}}`


Copyright 2017-2022 Gregory Giecold and contributors.

pyRMT is free software made available under the MIT License. For details see the LICENSE file.

Project details

Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyRMT, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size pyRMT-0.1.0.tar.gz (7.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page