classification in all classification (or supervised learningproblemsthe first step after preparing the whole dataset is to segregate the data into testing and training set and optionally validation set the idea is to make the model learn by training it on the train datasetevaluate and tune it on the validation datasetor use techniques like cross validation and finally check its performance on the test dataset you will learn in the model evaluation section of this that evaluating model is critical part of any machine learning solution henceas rule of thumbwe must always remember that the actual evaluation of machine learning algorithm is always on the data that it has not previously seen (even cross validation on the training dataset will use part of the train data for model building and the rest for evaluationsometimes we will use the whole dataset to train the model and then use some subset of it as test set this is common mistake done by many of us often in machine learning to accurately analyze modelit must generalize well and perform well on data that it has never seen before good evaluation metric on training data but bad performance on unseen (validation or testdata means that the algorithm has failed to produce generalized solution for the problem (more on this laterfor our classification examplewe will use popular multi-class classification problem we talked about earlierhandwritten digit recognition the data for the same is available as part of the scikit-learn library the problem here is to predict the actual digit value from handwritten image of digit in its original form the problem comes in the domain of image based classification and computer vision in the dataset we have is feature vectorwhich represents the image representation of grey scale image of the handwritten digit before we proceed to building any modellet' first see how both the data and the image we intend to analyze look the following code will load the data for the image at index and plot it in [ ]from sklearn import datasets import matplotlib pyplot as plt %matplotlib inline digits datasets load_digits(plt figure(figsize=( )plt imshow(digits images[ ]cmap=plt cm gray_rthe image generated by the code is depicted in figure - any guesses as to which number it representsfigure - handwritten digit data representing the digit zero