Code Monkey home page Code Monkey logo

cu-nmf's Introduction

cu-nmf

NMF(Non-negative Matrix Factorization) based on cuda, with sparse matrix as input.

NMF_pgd.cu This code solves NMF by alternative non-negative least squares using projected gradients. It's an implementation of Projected gradient methods for non-negative matrix factorization. You may read the paper for more details.

NMF_gd.cu Directly GD(gradient descent) with fixed learning rate is only a simple demo for study. Using alternating non-negative least square to slove NMF problem, GD is not a correct method because of the projection while training.

Requirements

The code is base on cuda, cuBlas and cuSparse precisely. Please get cuda from Nvidia's website, https://developer.nvidia.com/cuda-downloads.

Usage

The input matrix is store in a .txt file in sparse format. The first line is row and column number. Then Each line is a non-zero value with its row index and column index. All numbers are split by a blank. The Index is 0 based. For example, text.txt. Results will be saved in two files, W.txt and H.txt in dense format.

You should use nvcc to compile the code, so make sure cuda is installed and environment is correctly setted.

$ make
$ ./NMF_pgd -train test.txt
  • -train The file storing matrix V in sparse format, required.
  • -factor Factor number, which is n in fractorization mk=(mn)(n*k), default is 3.
  • -maxiter Max iter number for alternating update, default is 100.
  • -timelimit Sometimes the algorithm takes a long time to converge, you may want to stop early, default is 1000s.
  • -tol Tolerance of stop condition; default is 0.001.
  • -gpuid Choose the gpu device to use, default is 0.

cu-nmf's People

Contributors

wibosa avatar

Watchers

James Cloos 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.