(self, K=5, max_iters=100, plot_steps=False)
| 7 | class KMeans: |
| 8 | |
| 9 | def __init__(self, K=5, max_iters=100, plot_steps=False): |
| 10 | self.K = K |
| 11 | self.max_iters = max_iters |
| 12 | self.plot_steps = plot_steps |
| 13 | |
| 14 | # list of sample indices for each cluster |
| 15 | self.clusters = [[] for _ in range(self.K)] |
| 16 | |
| 17 | # the centers (mean vector) for each cluster |
| 18 | self.centroids = [] |
| 19 | |
| 20 | |
| 21 | def predict(self, X): |
nothing calls this directly
no outgoing calls
no test coverage detected