https://github.com/2020leon/rpca
Python implementation of robust principal component analysis
https://github.com/2020leon/rpca
alm alternating-lagrangian-multipliers anomaly-detection background-detection numpy pca principal-component-analysis python python3 robust-pca robust-principal-component-analysis rpca
Last synced: about 23 hours ago
JSON representation
Python implementation of robust principal component analysis
- Host: GitHub
- URL: https://github.com/2020leon/rpca
- Owner: 2020leon
- License: mit
- Created: 2023-06-21T09:16:28.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-26T08:55:55.000Z (about 1 year ago)
- Last Synced: 2025-06-17T15:51:42.236Z (4 months ago)
- Topics: alm, alternating-lagrangian-multipliers, anomaly-detection, background-detection, numpy, pca, principal-component-analysis, python, python3, robust-pca, robust-principal-component-analysis, rpca
- Language: Python
- Homepage:
- Size: 16.6 KB
- Stars: 20
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# RPCA
[Robust principal component analysis] (robust PCA, RPCA) is a modification of principal component analysis (PCA) which works well with respect to grossly corrupted observations. The package implements robust PCA in exact alternating Lagrangian multipliers (EALM) algorithm and inexact alternating Lagrangian multipliers (IALM) algorithm. The implementation refers [the paper][Lin] and [its MATLAB implementation][MATLAB packages].
## Installation
Use the package manager [`pip`] to install.
```shell
pip install git+https://github.com/2020leon/rpca.git@v1.1.0
```## Usage
```python
import numpy as npimport rpca.ealm
import rpca.ialmRNG = np.random.default_rng()
D = RNG.random((20, 20))
A0, E0 = rpca.ealm.fit(D)
A1, E1 = rpca.ialm.fit(D)
```## Contributing
Contributing is welcome!
## License
MIT
## References
- [Robust principal component analysis - Wikipedia][Robust principal component analysis]
- [Z. Lin, M. Chen, and Y. Ma, "The Augmented Lagrange Multiplier Method for Exact Recovery of Corrupted Low-Rank Matrices," 2010. doi: https://doi.org/10.48550/arXiv.1009.5055.][Lin]
- [MATLAB packages][Robust principal component analysis]: https://en.wikipedia.org/wiki/Robust_principal_component_analysis
[Lin]: https://doi.org/10.48550/arXiv.1009.5055
[MATLAB packages]: https://people.eecs.berkeley.edu/~yima/matrix-rank/sample_code.html
[`pip`]: https://pip.pypa.io/en/stable/