Python module to train GMMs using CUDA
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
ggmm
tests
.gitignore
LICENSE
README.md
ggmm_kernels.cu
setup.py

README.md

ggmm

Python module to train GMMs using CUDA (via CUDAMat)

Contents

Dependencies
Installation
Example usage
Documentation

Dependencies

Installation

Clone ggmm and CUDAMat in local install path:

cd ${INSTALL_PATH}
git clone https://github.com/ebattenberg/ggmm.git
git clone https://github.com/cudamat/cudamat.git

Compile and install CUDAMat:

cd ${INSTALL_PATH}/cudamat
sudo python setup.py install

Run CUDAMat tests (optional, requires nose):

cd ${INSTALL_PATH}/cudamat
nosetests

Run ggmm tests (optional, requires nose):

cd ${INSTALL_PATH}/ggmm
nosetests

Install ggmm:

cd ${INSTALL_PATH}/ggmm
sudo pip install .

Example Usage

import ggmm.gpu as ggmm

X = some_module.load_training_data()

# N - training examples
# D - data dimension
# K - number of GMM components
N, D = X.shape
K = 128

ggmm.init()
gmm = ggmm.GMM(K,D)

thresh = 1e-3 # convergence threshold
n_iter = 20 # maximum number of EM iterations
init_params = 'wmc' # initialize weights, means, and covariances

# train GMM
gmm.fit(X, thresh, n_iter, init_params=init_params)

# retrieve parameters from trained GMM
weights = gmm.get_weights()
means = gmm.get_means()
covars = gmm.get_covars()

# compute posteriors of data
posteriors = gmm.compute_posteriors(X)

Documentation

Documentation available here