find the closest centroid to each input data point