(data, centroids)
| 81 | |
| 82 | |
| 83 | def assign_clusters(data, centroids): |
| 84 | # Compute distances between each data point and the set of centroids: |
| 85 | # Fill in the blank (RHS only) |
| 86 | distances_from_centroids = centroid_pairwise_dist(data, centroids) |
| 87 | |
| 88 | # Compute cluster assignments for each data point: |
| 89 | # Fill in the blank (RHS only) |
| 90 | cluster_assignment = np.argmin(distances_from_centroids, axis=1) |
| 91 | |
| 92 | return cluster_assignment |
| 93 | |
| 94 | |
| 95 | def revise_centroids(data, k, cluster_assignment): |
no test coverage detected