Skip to content

flowstateeng/MNIST-Polynomial-Regression-Classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MNIST Digits

MNIST-Polynomial-Regression-Classifier

This is a Polynomial Regression model that learns to classify hand-written digits from the MNIST dataset. Try different values for 'lambda' and 'p' to experiment with output.

Build Status License


Contents


Prerequisites

  • Python
  • Numpy
  • Matplotlib

Installation

  git clone https://github.com/chivington/MNIST-Polynomial-Regression-Classifier.git

Testing

Change into the directory and run:

  python mnist_polynomial_regression_classifier.py

Usage

Open the file 'mnist_polynomial_regression_classifier.py' and edit the hyperparameters 'lambda' (named "lambd" in the code since "lambda" is a reserved keyword in the Python programming language) and the vector 'p' to experiment with finding optimal values for accuracy and quick convergence. The program will:

  1. Load the MNIST dataset.
  2. Split it into "training," "validation," and "testing" sets.
  3. Display a random digit from the training set.
  4. Train the model on the various p-values, displaying the training error, test error and training time.
  5. Display a plot of the training errors, validation errors, training times, with respect to the various p-values.
  6. Display a digit from the test set, along with it's classification and label.
  7. Print out the final training and test set errors to the terminal.
  8. End.

Large values of 'p' will result in increased training times. For my Surface Book (2.81ghz i7, 8gb ram, GeForce 940m), a p-value of 7500 takes ~374 seconds to train and achieves ~4.48% testing error rate, as shown in the images below. The datasets needed to train and make predictions are included and you should not have to move or rename any files or filenames in the code.

Feel free to ask me questions on GitHub or LinkedIn


Random Digit


Training & Validation Errors


Classification Test



Authors

Contributing

Not currently accepting outside contributors, but feel free to use as you wish.

License

There is no license associated with this content.