0
6.2kviews
Use Data set in Appendix A. Use K-means algorithm to create two clusters.
1 Answer
0
716views

enter image description here

Step 1: Consider A and B be the main clusters.

Let c1 and c2 denotes the co-ordinate of the centroid.

So, c1= (2, 2), c2= (3, 2)

I X1 X2
A 2 2
B 3 2
C 1 1
D 3 1
E 1.5 0.5

Step 2:

Distance from first centroid c1 = (2, 2) to B = (3, 2)

c1 (2, 2) is $\sqrt{(3-2)^2+(2-2)^2}=1$

Distance from first centroid c1 = (2, 2) to C = (1, 1)

c1 (2, 2) is $\sqrt{(2-1)^2+(2-1)^2}=1.41$

Distance from first centroid c1 = (2, 2) to D = (3, 1)

c1 (2, 2) is $\sqrt{(3-2)^2+(1-2)^2}=1.41$

Distance from first centroid c2 = (2, 2) to E = (1.5, 0.5)

c1 (3, 2) is $\sqrt{(2-1.5)^2+(2-0.5)^2}=1.58$

Distance from first centroid c2 = (3, 2) to C = (1, 1)

c1 (3, 2) is $\sqrt{(3-1)^2+(2-1)^2}=2.24$

Distance from first centroid c2 = (3, 2) to D = (3, 1)

c1 (3, 2) is $\sqrt{(3-3)^2+(2-1)^2}=1$

Distance from first centroid c2 = (3, 2) to E = (1.5, 0.5)

c1 (3, 2) is $\sqrt{(3-1.5)^2+(2-0.5)^2}=2.12$

$ D0=\begin{matrix} \ 0 & 1 & 1.41 & 1.41 & 1.58\\ 1& 0 & 2.24 & 1 & 2.12\\ \end{matrix}$

We assign objects based on min distance to G0.

$ G0=\begin{matrix} \ 1 & 0 & 1 & 0 & 1\\ 0 & 1 & 0 & 1 & 0\\ \end{matrix}$

Now we compute the new centroid of each group as shown below.

c1 = (((2+1+1.5)/3), ((2+1+0.5)/3)) = (1.5, 1.167)

c2 = (((3+3)/2), ((2+1)/2)) = (3, 1.5)

The next step is to compute the distance of all objects to the new centroid.

Similar to above steps we have distance matrix at iteration 1 is

$ D1=\begin{matrix} \ 0.97 & 1.71 & 0.53 & 1.51 & 0.67\\ 1.12 & 0.5 & 2.06 & 0.5 & 1.80\\ \end{matrix} $

$ G1=\begin{matrix} \ 1 & 0 & 1 & 0 & 1 \\ 0 & 1 & 0 & 1 & 0\\ \end{matrix} $

We obtain the result that G0=G1.

Comparing the grouping of last iteration and this iteration reveals that the object does not move group anymore.

Thus, we get final grouping as the result

I X1 X2 Group
A 2 2 1
B 3 2 2
C 1 1 1
D 3 1 2
E 1.5 0.5 1
Please log in to add an answer.