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


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

https://www.kaggle.com/archaeocharlie/a-beginner-s-approach-to-classification

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: