(self, ax=None, holdon=False)
| 135 | return distance == 0 |
| 136 | |
| 137 | def plot(self, ax=None, holdon=False): |
| 138 | sns.set(style="white") |
| 139 | palette = sns.color_palette("hls", self.K + 1) |
| 140 | data = self.X |
| 141 | |
| 142 | if ax is None: |
| 143 | _, ax = plt.subplots() |
| 144 | |
| 145 | for i, index in enumerate(self.clusters): |
| 146 | point = np.array(data[index]).T |
| 147 | ax.scatter( |
| 148 | *point, |
| 149 | c=[ |
| 150 | palette[i], |
| 151 | ], |
| 152 | ) |
| 153 | |
| 154 | for point in self.centroids: |
| 155 | ax.scatter(*point, marker="x", linewidths=10) |
| 156 | |
| 157 | if not holdon: |
| 158 | plt.show() |
no outgoing calls
no test coverage detected