In my previous blogs, we had gone through “MNIST Largest Handwritten Digits Database”. In addition, there are prebuilt python libraries available from Tensorflow, Pytorch, MNIST, etc.

In this blog, let’s walk through the following steps:

  • Use a simple MNIST dataset and how to import it
  • Import MNIST data and target
  • Split train and test datasets (we use only train dataset as this is one example; however, we can extend later in future blogs)
  • Train and predict a digit using Sklearn Stochastic Gradient Descent (SGD)

You can find a full code in this blog, and also you can download it from the GitHub repository.

Copy to Clipboard
Copy to Clipboard
dict_keys(['data', 'target', 'frame', 'feature_names', 'target_names', 'images', 'DESCR'])
Copy to Clipboard
Copy to Clipboard
(1797, 64)
Copy to Clipboard
(1797,)
Copy to Clipboard
MNIST Classifier first digit
Copy to Clipboard
Copy to Clipboard
(1600, 64)
Copy to Clipboard
(197, 64)
Copy to Clipboard
(1600,)
Copy to Clipboard
(197,)
Copy to Clipboard
Copy to Clipboard
Copy to Clipboard

Hurray! the Stochastic Gradient Descent(SGD) classifier predicted as “True”.

array([ True])