Giter Site home page Giter Site logo

nmf-python's Introduction

Python Toolbox for Nonnegative Matrix Factorization

This package includes Python implementations (with Numpy and Scipy) of numerical algorithms for computing nonnegative matrix factorization.

Requirements

Numpy (http://www.numpy.org) and Scipy (http://www.scipy.org) need to be installed. Versions of Numpy and Scipy tested with this code were 1.6.1 and 0.9.0, respectively.

Installation

Use setup.py to install this package:

sudo python setup.py install

Usage Instructions

When A is a dense (numpy.array) or a sparse (scipy.sparse) matrix, the following code returns W and H as factor matrices of A with 10 as the lower rank.

from nonnegfac.nmf import NMF
W, H, info = NMF().run(A, 10)

Try to execute example.py to see simple usage. Function run() executes an NMF algorithm once, and Function run_repeat() executes an NMF algorithm for the specified number of times and returns the best result based on the norm of the error matrix. See nmf.py for the optional arguments and the return information of run() and run_repeat().

There are several algorithms implemented and included as separate classes. A specific algorithm can be used by creating an instance of one of the following classes. By default, NMF() creates an instance of NMF_ANLS_BLOCKPIVOT; another fast algorithm is NMF_HALS. Examples of using each of these algorithms are also included in example.py. See nmf.py and the following references for more information of algorithms.

  • NMF_ANLS_BLOCKPIVOT - ANLS with block principal pivoting
  • NMF_ANLS_AS_NUMPY - ANLS with scipy.optimize.nnls solver
  • NMF_ANLS_AS_GROUP - ANLS with active-set method and column grouping
  • NMF_HALS - Hierarchical alternating least squares
  • NMF_MU - Multiplicative updating

References

  1. Jingu Kim, Yunlong He, and Haesun Park. Algorithms for Nonnegative Matrix and Tensor Factorizations: A Unified View Based on Block Coordinate Descent Framework. Journal of Global Optimization, 58(2), pp. 285-319, 2014. http://link.springer.com/content/pdf/10.1007%2Fs10898-013-0035-4.pdf

  2. Jingu Kim and Haesun Park. Fast Nonnegative Matrix Factorization: An Active-set-like Method And Comparisons. SIAM Journal on Scientific Computing (SISC), 33(6), pp. 3261-3281, 2011. https://sites.google.com/site/jingukim/2011_paper_sisc_nmf.pdf

Feedback

Please send bug reports, comments, or questions to Jingu Kim. Contributions and extensions with new algorithms are welcome.

nmf-python's People

Contributors

kimjingu avatar ramkikannan avatar dhhagan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.