K-Means Algorithm Example

12,165 views

Published on

5 Comments
1 Like
Statistics
Notes
No Downloads
Views
Total views
12,165
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
473
Comments
5
Likes
1
Embeds 0
No embeds

No notes for slide

K-Means Algorithm Example

  1. 1. K-MEANS ALGORITHM EXAMPLEAuthor: Kasun Ranga WijeweeraEmail: krw19870829@gmail.com(TOTAL MARKS = 30)Consider following eight points.P1 (2, 2), P2 (1, 14), P3 (10, 7), P4 (1, 11), P5 (3, 4), P6 (11, 8), P7 (4, 3), P8 (12, 9)Take P1, P2, and P7 as initial centroids. Then apply k-means clustering algorithm to calculatetwo successive positions of those centroids.Note:The distance function between two points P1 (x1, y1) and P2 (x2, y2) is defined as:D (P1, P2) = | x1 – x2 | + | y1 – y2 |ANSWERTable 1 C1 = (2, 2) C2 = (1, 14) C3 = (4, 3)D (P, C1) D (P, C2) D (P, C3) ClusterP1 (2, 2) 0 13 3 C1P2 (1, 14) 13 0 14 C2P3 (10, 7) 13 16 10 C3P4 (1, 11) 10 3 11 C2P5 (3, 4) 3 12 2 C3P6 (11, 8) 15 16 12 C3P7 (4, 3) 3 14 0 C3P8 (12, 9) 17 16 14 C3C1 = (2/1, 2/ 1) = (2, 2); (1 marks)C2 = ((1 + 1)/2, (14 + 11)/2) = (1, 12.5); (1 marks)C3 = ((10 + 3 + 11 + 4 +12)/5, (7 + 4 + 8 + 3 + 9)/5) = (8, 6.2); (1 marks)
  2. 2. Table 2 C1 = (2, 2) C2 = (1, 12.5) C3 = (8, 6.2)D (P, C1) D (P, C2) D (P, C3) ClusterP1 (2, 2) 0 11.5 10.2 C1P2 (1, 14) 13 1.5 14.2 C2P3 (10, 7) 13 14.5 2.8 C3P4 (1, 11) 10 1.5 11.8 C2P5 (3, 4) 3 10.5 7.2 C1P6 (11, 8) 15 14.5 4.8 C3P7 (4, 3) 3 12.5 7.2 C1P8 (12, 9) 17 14.5 6.8 C3C1 = ((2 +3 + 4)/3, (2 + 4 + 3)/3) = (3, 3); (1 marks)C2 = ((1 + 1)/2, (14 + 11)/2) = (1, 12.5); (1 marks)C3 = ((10 + 11 + 12)/3, (7 + 8 + 9)/3) = (11, 8); (1 marks)Each row of the tables (except first two rows) should be given marks as followsPn (x, y) a (1/3 marks) b (1/3 marks) c (1/3 marks) Ck (1/2 marks)

×