MCPcopy Create free account
hub / github.com/AssemblyAI-Community/Machine-Learning-From-Scratch / __init__

Method __init__

10 KMeans/kmeans.py:9–18  ·  view source on GitHub ↗
(self, K=5, max_iters=100, plot_steps=False)

Source from the content-addressed store, hash-verified

7class 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):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected