AI k-nearest neighbor algorithms