Non-negative Matrix Factorization (NMF)

Chih-Jen Lin


The code can be directly run on GPU. See example below. (added on April 19, 2020)

This tool solves NMF by alternative non-negative least squares using projected gradients. It converges faster than the popular multiplicative update approach. Details and comparisons are in the following paper:

C.-J. Lin. Projected gradient methods for non-negative matrix factorization. Neural Computation, 19(2007), 2756-2779.

If you find this tool useful, please cite the above work.

Download MATLAB Scripts

Please download nmf.m. The usage is

[W,H] = nmf(V,Winit,Hinit,tol,timelimit,maxiter);

Output/input parameters are

Please read the COPYRIGHT notice before using it.

This code works under Octave as well.

Frequently asked questions

Running on GPU

The code can be directly used without modification, but input matrices must be MATLAB gpuArray. See a simple example here

Implementations in other programming languages

Sources for comparing different methods for solving NMF

We compared our approach with the popular multiplicative update method in the above paper. All sources for experiments are in this zip file. The current version is 1.01. You can thus easily regenerate our results. After unzipping it, a directory including all files will be created. Then follow instructions in the README file.

Note that some sources here cannot be used under Octave.

Please send comments and suggestions to Chih-Jen Lin.