We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 72a28b4 commit 2cb9e37Copy full SHA for 2cb9e37
Mapping/kmeans_clustering/kmeans_clustering.py
@@ -68,7 +68,7 @@ def update_clusters(self):
68
dx = [icx - px for icx in self.center_x]
69
dy = [icy - py for icy in self.center_y]
70
71
- dist_list = [math.sqrt(idx ** 2 + idy ** 2) for (idx, idy) in zip(dx, dy)]
+ dist_list = [math.hypot(idx, idy) for (idx, idy) in zip(dx, dy)]
72
min_dist = min(dist_list)
73
min_id = dist_list.index(min_dist)
74
self.labels[ip] = min_id
0 commit comments