Hi,
I was playing with the number of neighbors of a KNeighborsClassifier, and I trained it with only 1 neighbor. I then run a prediction using the same dataset, and I got an accuracy of 77%, instead of 100%.
Is there something I am not understanding ? With one neighbor, testing on the training data would always find the exact data, hence giving 100% precision.
I tested with adult_census_numerical data, and the following code.
model = KNeighborsClassifier(n_neighbors=1)
model.fit(data,target)
model.score(data,target).mean()
Thank you for your answer.