Classification using Naive Bayes on the MNIST dataset. For project explanation see [1]
You can run the code using python run_naive_bayes.py --trainpath PATH_TO_TRAIN --testpath PATH_TO_TEST --algorithm ALGORITHM_CODE
. There are four options for algorithm
:
B
- Image is binarized and features are modeled as Bernoulli random variables.G_gray
- Original grayscale values of the image are used as features and modeled as jointly Gaussian random variables.G_pca
- PCA is used for dimensionality reduction of images before classification.G_hog
- Histogram of oriented gradients are computed from the image and used as features for classification.
You'll require access to the MNIST dataset which can be obtained from [2]. For ease of use, the code has been written to load the data in .csv
format which can be obtained from [3]. After downloading store the datasets in ./data/
.
[1] - Deepankar C. - A Primer to Bayes' Classifier
[2] - Y. LeCun, C. Cortes, C. Burges - The MNIST Database
[3] - MNIST in CSV