maxfuse.utils.get_centroids
- maxfuse.utils.get_centroids(arr, labels)[source]
Compute the centroids (cluster mean) of arr.
- Parameters:
arr (np.array of shape (n_samples, n_features)) – Data matrix
labels (np.array of shape (n_samples,)) – Cluster labels of each sample, coded from 0, …, num_clusters-1
- Returns:
centroids (np.array of shape (n_centroids, n_features)) – Matrix of cluster centroids, the i-th column is the centroid of the i-th cluster