Skip to content

Latest commit

 

History

History
76 lines (57 loc) · 4.53 KB

README.md

File metadata and controls

76 lines (57 loc) · 4.53 KB

TopCorr

A small Python library for constructing filtered correlation networks

Getting Started

The package requires networkx and numpy. Scikit-learn is used in some of the examples to generate correlation matrices.

It can be installed using pip:

pip install topcorr

An example for creating a PMFG

import topcorr
import networkx as nx
import numpy as np
from sklearn.datasets import make_spd_matrix

p = 50
n = 200
C = make_spd_matrix(p)
X = np.random.multivariate_normal(np.zeros(p), C, n)
corr = np.corrcoef(X.T)

pmfg_G = topcorr.pmfg(corr)

The other methods work in much the same way (bar thresholding) - put in a correlation matrix and it will return a networkx graph.

Testing

If you're interested in running the tests they can be found in the /tests/ folder and are to be run with nose2.

For the TMFG the authors have provided an R implementation, so we test against that. This requires that you install rpy2 and the NetworkToolbox package. The other tests will also require the installation of sklearn.

Authors

  • Tristan Millington

License

This project is licensed under the GNU GPL - see the LICENSE.md file for details

Implemented

  • MST
  • PMFG
  • TMFG
  • Thresholding
  • Dependency Network
  • k-Nearest Neighbours Network
  • Partial Correlation
  • Affinity Matrix
  • Average Linkage MST
  • Forest of MSTs
  • Detrended Cross Correlation Analysis

References