k-nearest neighbors algorithm for cs170