Skip to main content

Optimization and Regularization variants of NMF

Project description

# libNMF

The library contains implementations of different optimization and regularization variants of non-negative matrix factorization.

List of algorithms implemented: 1. Multiplicative Update Rule (nmf.py) 2. Alternating Least Squares NMF (alsnmf.py) 3. Graph Regularized NMF (gnmf.py) 4. Probabilistc NMF (pnmf.py) 5. Kernel NMF (knmf.py) 6. Chambolle-Pock based first-order primal dual algo (fpdnmf.py)

## Setup:

To get the project’s source code, clone the github repository:

$ git clone https://github.com/satwik77/libnmf.git

Install VirtualEnv using the following (optional):

$ [sudo] pip install virtualenv

Create and activate your virtual environment (optional):

$ virtualenv venv $ source venv/bin/activate

Install all the required packages:

$ pip install -r requirements.txt

Install the library by running the following command from the root directory of the repository:

$ python setup.py install

## Usage:

>>> import numpy as np
>>> # For Graph Regularized NMF
>>> from libnmf.gnmf import GNMF
>>> X = np.random.random((10,10))
>>> gnmf= GNMF(X, rank=4)
>>> gnmf.compute_factors(max_iter= 20, lmd= 0.3, weight_type='heat-kernel', param= 0.4)
>>> # For first-order primal-dual algo
>>> from libnmf.fpdnmf import FPDNMF
>>> fpdnmf= FPDNMF(X, rank=4)
>>> fpdnmf.compute_factors(max_iter=30, nditer=5)
>>> #print fpdnmf.W, fpdnmf.H, fpdnmf.div_error

Refer to examples/Simple-Usage.ipynb for more on usage.

## References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libNMF-0.1.1.tar.gz (6.3 kB view hashes)

Uploaded Source

Built Distribution

libNMF-0.1.1-py3-none-any.whl (10.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page