Recognizing Handwritten Digits with scikit-learn

In today’s blog we are going to analyze the digits data-set of the Sci-Kit learn library. We are going to train a Support Vector Machine and then we will be predicting the values of a few unknown Handwritten digits.

Let us start by importing our libraries

Our data-set is stored in digits

Following is an example of a digit in our dataset. It consists of 64 pixels (8X8).

The 1792nd element in our data-set

Let us train our SVM with the first 1790 images in out data-set. After that we will use the remaining Data-set as our test data and check the accuracy of our training machine.

Both predicted and target values are same

As we can see we have achieved 100% accuracy. Let us now define a function that will find the accuracy of our SVM and train our model with varying data-set. We will start with 3 elements in our training data and work our way up to 1790 data and store the accuracy of our models in a dictionary

The values dictionary holds all the accuracies

Let us plot our dictionary.

accuracy vs size of training-set

As we can clearly see for well above 95% of our models the achieved accuracy is 100% . Hence we can easily conclude that our model works for more than 95% of the time.

I am thankful to mentors at https://internship.suvenconsultants.com for providing awesome problem statements and giving many of us a Coding Internship Exprience. Thank you www.suvenconsultants.com"

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response