How to solve K-Means Algorithm
Numerical?
Q. Apply K(=2)-Means algorithm over the data below
Where date ={ (185, 72), (170, 56), (168, 60),
(179,68), (182,72), (188,77)} up to two iterations
and show the clusters. Initially choose first two
objects as initial centroids.
Solution:
Given, number of clusters to be created (K) = 2 say c1 and c2,
number of iterations = 2 and
The given data points can be represented in tabular form as:
Data Points
also, first two objects as initial centroids:
Centroid for first cluster c1 = (185, 72)
Centroid for second cluster c2 = (170, 56)
Iteration 1: Now calculating similarity by using Euclidean
distance measure as:
Euclidean distance calculation
Representing above information in tabular form:
Distance of each data points from cluster centroids
The resulting cluster after first iteration is:
Data points cluster
Iteration 2: Now calculating centroid for each cluster:
Calculating centroid as mean of data points
Now, again calculating similarity:
Distance calculation between data points and centroids
Representing above information in tabular form.
Distance of each data points from cluster centroids
The resulting cluster after second iteration is:
Data points cluster
As we have already completed two iteration as asked by our question,
the numerical ends here.
Since, the clustering doesn’t change after second iteration, so
terminate the iteration even if question doesn’t say so.