modified kNN training