Skip to content

Robust Orthonormal Subspace Learning in Python

License

Notifications You must be signed in to change notification settings

tjof2/robustpca

Repository files navigation

Build Status Coverage Status DOI

Robust PCA

Python and C++ implementation of Robust Orthonormal Subspace Learning using the Armadillo linear algebra library.

Description

This is a C++ implementation of the Robust Orthonormal Subspace Learning (ROSL) algorithm [1]. ROSL solves the robust PCA problem, recovering a low-rank matrix X and a sparse error matrix E from the corrupted observations Y according to Y=X+E. ROSL also incorporates a memory-efficient method ("ROSL+") for recovering X from a random sub-sample of the matrix Y.

[1] X. Shu, F. Porikli and N. Ahuja, "Robust Orthonormal Subspace Learning: Efficient Recovery of Corrupted Low-Rank Matrices," 2014 IEEE Conference on Computer Vision and Pattern Recognition, Columbus, OH, 2014, pp. 3874-3881, DOI: 10.1109/CVPR.2014.495.

Installation

Dependencies

This library makes use of the Armadillo C++ linear algebra library, which needs to be installed first. It is recommended that you use a high-speed replacement for LAPACK and BLAS such as OpenBLAS, MKL or ACML; more information can be found in the Armadillo FAQs.

One way to install the latest version of Armadillo is to run:

$ tar -xzf robustpca.tar.gz
$ cd robustpca
$ ./install-dependencies.sh

Building from source

To build and install the library, run:

$ tar -xzf robustpca.tar.gz
$ cd robustpca
$ python setup.py build_ext --inplace
$ pip install -U .

Usage

import numpy as np

from robustpca import ROSL

X = np.random.randn(100, 100)
rosl = ROSL(n_components=3)
Y = rosl.fit_transform(X)

Copyright (C) 2015-2020 Tom Furnival. robustpca is released free of charge under the GNU General Public License (GPLv3).