How many neighbours should get a vote? You decide to try a few values and keep the one that does best on the test rows.
Task: write best_k(ks). ks is a list of whole numbers to try for n_neighbors.
train_test_split(X, y, test_size=0.25, random_state=0). Split once and reuse it for every k.k, train a KNeighborsClassifier(n_neighbors=k) on the training rows and score it on the test rows.[best k, its test score rounded to 3 decimal places].k tie for the best score, pick the smallest of them.