Professor蔡崇煒
Members 4103056002 杜 杰 4103056029 黃 冕 4103056041 陳仲彥 4104056009 洪浩祐
2017/04/18
Iris
Original Data
Our result
Drawback
Animation
randomly chose k centroids.
assign each observation to the nearest centroid (cluster).
calculate new means to be the centroids in the new clusters.
Initialization:
Assignment:
Update:
random.shuffle(observations) centers = dict((c,[c]) for c in observations[:k]) centers[observations[k-1]] += observations[k:]
for j in centers: for x in centers[j]: best = min(centers, key=lambda c: dist(x,c)) new_centers[best] += [x]
for j in centers: new_centers[mean(centers[j])] = centers[j]
Watch again!
Within-cluster Sum of Squares (WCSS)
Variance
Variance - Iteration chart
By jd615645
105-2 Data Mining & Machine Learning