Zad3 TODOs
This commit is contained in:
parent
0e4795ed43
commit
baab800220
@ -77,7 +77,7 @@ def calc_length(a, b):
|
|||||||
return (b[0]-a[0])**2+(b[1]-a[1])**2
|
return (b[0]-a[0])**2+(b[1]-a[1])**2
|
||||||
|
|
||||||
|
|
||||||
def init_centroids(data, k, method='forgy'):
|
def init_centroids(data, k, method='forgy'): #TODO: Add k-means++ and Random Partition
|
||||||
match method:
|
match method:
|
||||||
case 'forgy':
|
case 'forgy':
|
||||||
return sample(data, k)
|
return sample(data, k)
|
||||||
@ -119,7 +119,7 @@ def main():
|
|||||||
kmeans_data = {}
|
kmeans_data = {}
|
||||||
for k in range(2, 21):
|
for k in range(2, 21):
|
||||||
kmeans_with_err = []
|
kmeans_with_err = []
|
||||||
for _ in range(10):
|
for _ in range(100):
|
||||||
all_data = []
|
all_data = []
|
||||||
centroids = init_centroids(data, k)
|
centroids = init_centroids(data, k)
|
||||||
clusters = {}
|
clusters = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user