Skip to content

pk-organics/fastGNMF

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fastGNMF

Fast graph-regularized non-negative matrix factorization based on faiss for finding p-nearest neighbors.

Current version: 0.1.1

Runtime

(run on the same machine using randomly generated data matrix)

Other parameters used:

- lambda      = 0.5
- k           = 50
- p           = 8
- faiss index = IndexFlatL2
- # iterations= 100

Installation

1) Build and install the module

python setup.py install --user
pip install -r requirements.txt

2) Install faiss library

Follow the steps here.

Quick Start

Running GNMF on the example COIL20 dataset.

import fastGNMF

# groundtruth ~ to obtain the cluster labels
X, groundtruth = fastGNMF.examples.COIL20.read_dataset(rank=10, image_num=5)

# initialize gnmf instance with rank=10 and p=5 for p-nearest neighbors
#  use default parameters for the rest (lambda = 0.5)
gnmf = fastGNMF.Gnmf(X=X, rank=10, p=4)
U, V = gnmf.factorize()

# output a t-sne image
fastGNMF.examples.COIL20.visualize_tsne(V, 10, groundtruth, "COIL20 test with rank=10; lambda=0.5; p=4", "test.png", tsne_perplexity=5)

The code above will output and save an image below.

test_image

More detailed documentation can be found on the Wiki page.

About

Fast graph-regularized matrix factorization

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%