A tutorial for MNIST – Digit Recognition Using scikit learn

Introduction

This is again a note to myself. This code has been prepared following different tutorials and SO answers. I have tried to cover many of them in reference below. The notebook is commented to the best of my ability. Starting with 11% in first trial, the final model is able to achieve accuracy of 95%.

If you are new, you might want to read this first:

Introduction To Machine Learning

A tutorial To Find Best Scikit classifiers For Sentiment Analysis

Steps

  1. Import the data in a dataframe
  2. Make data series of pixel data and the label
  3. Split the data in test and train samples
  4. Use simple SVC without any tuning. (Got 11% accuracy)
  5. Modify the data. Take out the gradient of 0-255 and replace it with simple binary 0 and 1
  6. Again use SVC (Got 90% accuracy)
  7. Use GridSearchCV to find better value of parameters
  8. Again use SCV with the optimum value of parameters (Got 95% accuracy)

 

Code

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.


Reference:

http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html#sklearn.model_selection.GridSearchCV

https://stackoverflow.com/questions/46330329/finding-the-values-of-c-and-gamma-to-optimise-svm

 

If you liked this article and would like one such blog to land in your inbox every week, consider subscribing to our newsletter: https://skillcaptain.substack.com

One thought on “A tutorial for MNIST – Digit Recognition Using scikit learn

Add yours

Leave a Reply

Up ↑

%d bloggers like this: