This package provides algorithms to solve the Robust Principal Component Analysis (RPCA) problem, as presented by Candès et al.[1]. Currently, a single algorithm is implemented: it solves the Principal Component Pursuit (PCP) convex relaxation of RPCA from the same paper, using the Inexact Augmented Lagrange Multiplier (IALM) method from Lin et al.[2][3].
from pyrpca import rpca_pcp_ialm
# given an m x n data matrix
data = ...
# decide on sparsity factor.
# this parameter is also commonly known as 'lambda'.
sparsity_factor = 1.0 / numpy.sqrt(max(data.shape))
# run the ialm algorithm.
low_rank, sparse = rpca_pcp_ialm(data, sparsity_factor)
pip install pyrpca
Pull requests and feature requests are welcome. The current version is minimal and suits my personal needs, but feel free to make suggestions. Even if the repository looks inactive, I will still respond :)
- Emmanuel J. Candès, Xiaodong Li, Yi Ma, John Wright. Robust principal component analysis? Association for Computing Machinery 2011. (preprint on arXiv)
- Zhouchen Lin, Risheng Liu, Zhixun Su. Linearized Alternating Direction Method with Adaptive Penalty for Low-Rank Representation. arXiv 2011.
- Zhouchen Lin, Minming Chen, Yi Ma. The Augmented Lagrange Multiplier Method for Exact Recovery of Corrupted Low-Rank Matrices, V3. arXiv 2013.
Appreciation is due to various other Python implementations of RPCA that served as inspiration for this project. Below is a non-exhaustive list: