Skip to main content

Robust principal component analysis for Python

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].

Example

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)

Installing

pip install pyrpca

Feature requests and contributing

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 :)

References

  1. Emmanuel J. Candès, Xiaodong Li, Yi Ma, John Wright. Robust principal component analysis? Association for Computing Machinery 2011. (preprint on arXiv)
  2. Zhouchen Lin, Risheng Liu, Zhixun Su. Linearized Alternating Direction Method with Adaptive Penalty for Low-Rank Representation. arXiv 2011.
  3. Zhouchen Lin, Minming Chen, Yi Ma. The Augmented Lagrange Multiplier Method for Exact Recovery of Corrupted Low-Rank Matrices, V3. arXiv 2013.

Acknowledgements

Appreciation is due to various other Python implementations of RPCA that served as inspiration for this project. Below is a non-exhaustive list:

Metadata

Release files for pyrpca 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for pyrpca 1.0.1
File Interpreter ABI Platform Actions
pyrpca-1.0.1-py3-none-any.whl Python 3 none any Details for pyrpca-1.0.1-py3-none-any.whl

Release files / pyrpca-1.0.1-py3-none-any.whl

Download URL pyrpca-1.0.1-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
29a0edc6d9a608a649ac192194a7c93c5141a28678f480ccb601bf3415bf2f95
BLAKE2b-256 checksum
How to use checksums
4218d640394759392fd1f1707a7771c3f98edf6c7527c65e9f46bfcb1ff5796b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2025.

Transparency log

Security for pyrpca 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 1 file in this release has been uploaded with provenance metadata.

Attestation for pyrpca-1.0.1-py3-none-any.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page