When applying a nearest neighbors-based method to a data of, for instance, 2000 points, what is the largest number of neighbors that can be considered ? I am using a nearest neighbors method in an unsupervised fashion for anomaly detection.
The predicted value by the nearest neighbor algorithm will actually just take the average value of all points that are close to the new point.
It's up to you to find the number of neighbors that you want to consider. If you have 2000 data points, this are the 2000 'neighbors' of which you will select a number of
k neighbors for taking the average and using that average as prediction.
So the maximum number of
k is the number of data points in your training set. In your case this is 2000.