modify predict_knn function