I am fairly new to Mathematica. I've been playing around with ClusteringComponents. Assume we are clustering points in the plane using k-means clustering and EuclidianDistance as distance function:
data = RandomReal[10, {n, 2}];
clusters = ClusteringComponents[data, 2, 1, Method -> "KMeans",
"DistanceFunction" -> EuclideanDistance, "RandomSeed" -> 1]
Unfortunately, the function only returns the clusters assignments. Is there an easy way to pull out the centroids as well, or alternatively, is there another built-in function that accomplishes this?.