Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Cluster the given eight points with (x, y) representing locations with 3 clusters M1(3,11), M2(3,6),

M3(9,5), M4(6,9), M5(8,6), M6(7,5), M7(2,3), M8(5,10).

Solution: -

Iteration 1

Point Dist Mean 1 Dist Mean 2 Dist Mean 3 Cluster


3 11 (3,11) 0 5 9 1
3 6 (3,6)
9 5 (9,5)
6 9 (6,9)
8 6 (8,6)
7 5 (7,5)
2 3 (2,3)
5 10 (5,10)

First we list all points in the first column of the table above. The initial cluster centers – means, are
(3, 11), (6, 9) and (2, 3) - chosen randomly. Next, we will calculate the distance from the first point
(3, 11) to each of the three means, by using the distance function:

point mean1

x1, y1 x2, y2

(3, 11) (3, 11)

ρ(a, b) = |x2 – x1| + |y2 – y1|

ρ(point, mean1) = |x2 – x1| + |y2 – y1|

= |3– 3| + |11 – 11|

=0+0

=0

point mean2

x1, y1 x2, y2

(3, 11) (6,9)

ρ(a, b) = |x2 – x1| + |y2 – y1|


ρ(point, mean2) = |x2 – x1| + |y2 – y1|

= |6 – 3| + |9 – 11|

=3+2

=5

point mean3

x1, y1 x2, y2

(3, 11) (2, 3)

ρ(a, b) = |x2 – x1| + |y2 – y1|

ρ(point, mean2) = |x2 – x1| + |y2 – y1|

= |2 – 3| + |3 – 11|

=1+8

=9

So, which cluster should the point (3, 11) be placed in? The one, where the point has the shortest
distance to the mean – that is mean 1 (cluster 1), since the distance is 0.

Cluster 1 Cluster 2 Cluster 3

(3, 11)

So, we go to the second point (3, 6) and we will calculate the distance to each of the three means,
by using the distance function:

point mean1

x1, y1 x2, y2

(3, 6) (3, 11)

ρ(a, b) = |x2 – x1| + |y2 – y1|

ρ(point, mean1) = |x2 – x1| + |y2 – y1|


= |3 – 3| + |11 – 6|

=0+5

=5

point mean2

x1, y1 x2, y2

(3, 6) (6, 9)

ρ(a, b) = |x2 – x1| + |y2 – y1|

ρ(point, mean2) = |x2 – x1| + |y2 – y1|

= |6 – 3| + |9 – 6|

=3+3

=6

point mean3

x1, y1 x2, y2

(3, 6) (2, 3)

ρ(a, b) = |x2 – x1| + |y2 – y1|

ρ(point, mean2) = |x2 – x1| + |y2 – y1|

= |2 – 3| + |3 – 6|

=1+3

=4

So, we fill in these values in the table:

So, which cluster should the point (3, 6) be placed in? The one, where the point has the shortest
distance to the mean – that is mean 3 (cluster 3).
(3,11) (6,9) (2,3)
Point Dist Mean Dist Mean Dist Mean Cluster
M1 3 11 (3,11) 0 5 9 1
M2 3 6 (3,6) 5 6 4 3
M3 9 5 (9,5) 12 7 9 2
M4 6 9 (6,9) 5 0 10 2
M5 8 6 (8,6) 10 5 9 2
M6 7 5 (7,5) 10 5 7 2
M7 2 3 (2,3) 9 10 0 3
M8 5 10 (5,10) 3 2 10 2

Cluster 1 Cluster 2 Cluster 3

(3, 11) (9, 5) (3, 6)

(6, 9) (2, 3)

(8, 6)

(7, 5)

(5, 10)

You might also like