Introduction:
Recognizing handwritten text is a problem that can be traced back to the first automatic machines that needed to recognize individual characters in handwritten documents.
Classifying handwritten text or numbers is important for many real-world scenarios. For example, a postal service can scan postal codes on envelopes to automate the grouping of envelopes which has to be sent to the same place. This article presents recognizing the handwritten digits (0 to 9) using the famous digits data set from Scikit-Learn, using a classifier called Support Vector Machine.
Scikit-Learn:
Scikit-learn is a free software machine learning library for the Python programming language. t features various algorithms like support vector machine, random forests, and k-neighbors, and it also supports Python numerical and scientific libraries like NumPy and SciPy.
Scikit-Learn is a library for Python that contains numerous useful algorithms that can easily be implemented and altered for the purpose of classification and other machine learning tasks.
Support Vector Machine:
In machine learning, support-vector machines are supervised learning models with associated learning algorithms that analyze data used for classification and regression analysis.
Recognizing Handwritten Digits with Scikit-learn:
Scikit-learn provided multiple Support Vector Machine classifier implementations. SVC supports multiple kernel functions (used to split with non-linearly) but the training time complexity is quadratic with the number of samples. Multiclass classification is done with a one-vs-one scheme. On the other hand, LinearSVC only supports linear kernels but the training time is linear with the number of samples. The multiclass classification is done with a one-vs-others scheme.
Loading the Dataset:
The Scikit-learn library provides numerous datasets, among which we will be using a data set of images called Digits. This data set consists of 1,797 images that are 8x8 pixels in size. Each image is a handwritten digit in grayscale.
In python, the key function returns the names of the attributes of an object, in other words, which information is stored in the object in the form of other objects. Let's use this function to check what can be found in the digits object:
Visualize the image in 0 to 5
Let's start modeling using Support Vector Machine, making an instance of the model. Here the Model is learning the relationship between digits (x_train) and labels(y_train).

then predict the test set,
We use the different cases for a range of validation.
You can see that the svc estimator has learned correctly. It is able to recognize the handwritten digits, interpreting correctly all five digits of the validation set. And get the best accuracy score.