modified to plot optimal n in knn