Download the a1a and a1a.t datasets from http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary.html#a1a and modify the Python program we wrote in class to read in these two datasets. Pay special attention to ensure that the dataset dimensions of the training and test files match (Hint: use the larger of the two dimensions).
Write a Python function which takes as input two numpy 1-d arrays and computes the Euclidean distance between them. Recall that
Given a point in a1a.t compute its distance from each point in a1a using the above function.
Given a point in a1a.t find the index of its nearest neighbor. Predict the label as the label of its nearest neighbor. If the predicted label matches the label of the point then it is correctly classified.
Repeat the above step for all points in a1a.t and check what fraction are correctly classified.