Skip to content

jiwidi/gmm-classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GMM-classifier

A python implementation of both a Gaussian classifier and Gaussian mixture models.

Usage

Gaussian classifier

from gaussian_classifier import gaussian_classifier

(x_train, y_train), (x_test, y_test) = get_mnist("data/").load_data()
gauss = gaussian_classifier()
gauss.train(x_train,y_train,alpha=1.0) #Alpha value for smoothing
yhat = gauss.predict(x_test)
yhat!=y_test ## Error rate

GMM

from gmm_classifier import gmm_classifier

(x_train, y_train), (x_test, y_test) = get_mnist("data/").load_data()
x_train, y_train, x_validate, y_validate = splitvalidate(x_train,y_train)
gauss = gmm_classifier()
#Here we pass validate data for early stopping
gauss.train(x_train,y_train,x_validate,y_validate,k=5,alpha=1.0) #K number of mixtures and alpha value for smoothing
yhat = gauss.predict(x_test)
yhat!=y_test ## Error rate

Examples

You can check the example on they work with the mnist dataset on gc_mnist.py and gmm_mnist.py scripts under scripts/.

Results from gc_mnist.py

Unsmoothed Smoothed

Results from gmm_mnist.py with mnist data reduced to 30dimensions and 5 mixtures

Analysis of alpha Analysis of number of mixtures

About

Python implementation for a Gaussian mixture model classifier!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages