the exact knn preprocessing