Implementation of NMF algorithm in CUDA via python
This repository implements a number of Non-negative matrix facotrization (NMF) algorithms for Nvidia CUDA-GPUs using the python libraries (a) cudamat and (b) PyCUDA and scikit-cuda. The project was designed as a replacement for NMF-GPU by Mejia-Roa et al. that only implements Kullbach-Leibler divergence minimizing NMF. We use it to run different NMF algorithms on the GPU in the bratwurst project.
The project is designed so that only some of the used libries need to be installed. You can either run the solver on any normal CPU via numpy, or on CUDA capable GPUs via cudamat or PyCUDA and skcuda. Note that the latter does not support all matrix factorization. Performance is skcuda > cudamat > numpy, the latter especially depending on the used numpy BLAS lib.
NMF-CUDA includes the following NMF solver:
- original NMF by Lee & Seung 1999, 2001 for both cost functions Euclidean norm and Kullbach-Leibler divergence
- sparse NMF (i.e spare results, not deconvolution of sparse matrices)
- affine NMF from Laurberg & Hansen 2007
- semiNMF and convexNMF from Ding et al. 2010
Running nmf.py
gives the command line arguments. The project basically takes one large matrix (either a tabseparated text file or numpy matrix) and returns two (three for affine NMF) files of the same format for each NMF run.
The file nmf.py
is the command line callable script of the whole project. NMFbase.py
provides the NMF base object(s) that are then customized for the three used libraries (library combinations).