Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dganguli/robust-pca
A simple Python implementation of R-PCA
https://github.com/dganguli/robust-pca
Last synced: 4 days ago
JSON representation
A simple Python implementation of R-PCA
- Host: GitHub
- URL: https://github.com/dganguli/robust-pca
- Owner: dganguli
- License: mit
- Created: 2014-03-03T23:36:27.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-05-19T22:03:55.000Z (over 1 year ago)
- Last Synced: 2024-10-18T06:57:46.127Z (27 days ago)
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 226
- Watchers: 13
- Forks: 66
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Robust-PCA
==========A Python implementation of R-PCA using principle component pursuit by alternating directions. The theory and implementation of the algorithm is described here: https://arxiv.org/pdf/0912.3599.pdf (doi > 10.1145/1970392.1970395)
```python
# generate low rank synthetic data
N = 100
num_groups = 3
num_values_per_group = 40
p_missing = 0.2Ds = []
for k in range(num_groups):
d = np.ones((N, num_values_per_group)) * (k + 1) * 10
Ds.append(d)D = np.hstack(Ds)
# decimate 20% of data
n1, n2 = D.shape
S = np.random.rand(n1, n2)
D[S < 0.2] = 0# use R_pca to estimate the degraded data as L + S, where L is low rank, and S is sparse
rpca = R_pca(D)
L, S = rpca.fit(max_iter=10000, iter_print=100)# visually inspect results (requires matplotlib)
rpca.plot_fit()
plt.show()
```