MCPcopy Index your code
hub / github.com/rushter/MLAlgorithms / plot

Method plot

mla/kmeans.py:137–158  ·  view source on GitHub ↗
(self, ax=None, holdon=False)

Source from the content-addressed store, hash-verified

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()

Callers 3

kmeans_exampleFunction · 0.95
KMeans_and_GMMFunction · 0.95
print_curveFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected