Your SlideShare is downloading. ×
K-Means Algorithm Example
K-Means Algorithm Example
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

K-Means Algorithm Example

5,184

Published on

3 Comments
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total Views
5,184
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
215
Comments
3
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 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. 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)

×