(self)
| 87 | return sum(distances) == 0 |
| 88 | |
| 89 | def plot(self): |
| 90 | fig, ax = plt.subplots(figsize=(12, 8)) |
| 91 | |
| 92 | for i, index in enumerate(self.clusters): |
| 93 | point = self.X[index].T |
| 94 | ax.scatter(*point) |
| 95 | |
| 96 | for point in self.centroids: |
| 97 | ax.scatter(*point, marker="x", color="black", linewidth=2) |
| 98 | |
| 99 | plt.show() |
| 100 | |
| 101 | |
| 102 | # Testing |
no outgoing calls
no test coverage detected