Weighted Principal Component Analysis (PCA) in Python
BSD-3-CLAUSE License
Author: Jake VanderPlas
This repository contains several implementations of Weighted Principal Component
Analysis, using a very similar interface to scikit-learn's
sklearn.decomposition.PCA
:
wpca.WPCA
uses a direct decomposition of a weighted covariance matrix to
compute principal vectors, and then a weighted least squares optimization
to compute principal components. It is based on the algorithm presented
in Delchambre (2014)
wpca.EMPCA
uses an iterative expectation-maximization approach to solve
simultaneously for the principal vectors and principal components of
weighted data. It is based on the algorithm presented in
Bailey (2012).
wpca.PCA
is a standard non-weighted PCA implemented using the singular
value decomposition. It is mainly included for the sake of testing.
For an example application of a weighted PCA approach, See WPCA-Example.ipynb.
This package has the following requirements:
With these requirements satisfied, you can install this package by running
$ pip install wpca
or to install from the source tree, run
$ python setup.py install
To run the suite of unit tests, make sure nose
is installed and run
$ nosetests wpca