Recognizing Handwritten Digits with scikit-learn

Prerequisites

Before we move to the four-step first prepare the dataset and split to train and test using the below ways.

After loading the dataset, you can analyze the content. First, you can read lots of information about the datasets by calling the DESCR attribute.

Here I used the shape, size and type method to extract the data about the dataset.

The Scikit-Learn 4-Step Modeling Pattern

Step 1. Importing the model we want to use.

Step 2. Making an instance of the Model

Step 3. Training the Model

Step 4. Predicting the labels of new data

Measuring the performance of our Model

To test the accuracy of our predictions we can use accuracy_score

Confusion matrix

Using Seaborn to plot out Confusion matrix

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store