Skip to content

Latest commit

 

History

History
68 lines (43 loc) · 1.93 KB

README.md

File metadata and controls

68 lines (43 loc) · 1.93 KB

Yet another PCA package

A sklearn compatible python package for principal components analysis that includes several methods for PCA rank selection such as random matrix theory based thresholds, Wold style and bi-cross validation, Minka's method, Horn's Parallel Analysis, etc. See here for the list of currently supported rank selection methods as well as the corresponding references.

Installation

git clone https://github.com/idc9/pca.git
python setup.py install

Example

from pca.PCA import PCA
from pca.toy_data import rand_factor_model

# sample data from a factor model with 10 PCA components
X = rand_factor_model(n_samples=200, n_features=100,
                      rank=10, m=2, random_state=1)[0]

# fit PCA and select the rank by thresholding
# the singular values using the Marcenko Pastur distribution
pca = PCA(n_components='rmt_threshold',
          rank_sel_kws={'thresh_method': 'mpe'})
pca.fit(X)

Help and support

Additional documentation, examples and code revisions are coming soon. For questions, issues or feature requests please reach out to Iain: [email protected].

Contributing

We welcome contributions to make this a stronger package: data examples, bug fixes, spelling errors, new features, etc.

Citation

DOI