machine learning using centroid