- Test the accuracy of the Nearest Neighbor and K Nearest Neighbor algorithms on a dataset of breast cancers tumors
- The dataset was divided into two parts, the training set, containing 80% of the data, and the prediction set, containing the other 20%.
- The k-nearest neighbor algorithm was then used to predict whether the items in the prediction set were malignant or benign, by checking whether the nearest neighbors to it were malignant or benign
- This was then compared with the actual value of the tumors in the prediction set, and the accuracy was calculated
- For the nearest neighbor algorithm, the accuracy was about 91%
- For the k-nearest neighbor algorithm, the accuracy was 92% for k=3, and about 93% for both k=5 and k=7
- Thus the accuracy seems to increase as the value of k increases.