You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Results
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.
About
A program that uses the k nearest neighbor algorithm and training data to predict whether cancer is malignant or benign