Recognizes digits using the k-NN algorithm and the MNIST datasets for training and testing.
- The MNIST dataset is loaded
- The 70000 pieces dataset is samplet into parts of 5000
- The dataset is splitted into training & testing sets
- Error is tested using a given k-NN (3 in the code)
- Score is optimized by testing various k values and holding the best score
- The prediction is given by the model using the k value of the best score
For this example the best score is 3 and the worse score is 13.