Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following 1-D points (i.e., numbers): 0, 2, 4, 7, 10. Your task is

ID: 3904502 • Letter: C

Question

Consider the following 1-D points (i.e., numbers): 0, 2, 4, 7, 10. Your task is to apply the standard
k-means algorithm to partition these numbers into two clusters (i.e., k = 2). Use the following
pseudo-code for this problem:
Initialize the prototypes
Repeat until "convergence"
Assign each sample to the cluster of the closest prototype.
Recalculate each prototype as the mean of all the samples
belonging to that cluster.
A common approach to initialize the prototypes (cluster representatives) is to use points that are most
distant from one another. For the numbers here, this means that the initial prototypes p 1 and p 2 are at 0
and 10, respectively. Now follow the pseudo-code until convergence, and give the final clusters and
their prototypes.

Explanation / Answer

Solution: FOR FINDING REPRESENTATIVE , WE WILL USE MEAN OF THE CLUSTERS,

Initial Representative of our sets :

Step 1:

Representative of set 1 = 0

Representative of set 2 = 10.

Dividing the numbers , on the basis of closeness of number from representative of clusters

For Point 2

Dist( set1 , 2 ) = abs(2-0) = 2

Dist( set2 , 2 ) = abs(10 - 2) = 8.

2 is closest to cluster 1 , so put it into cluster 1.

For point 4 :

Dist( set1 , 4 ) < Dist(set2 , 4) [ abs(4 - 0) < abs( 4-10 ) ].

So put point 4 in cluster 1.

For point 7 :

Dist( set1 , 7) > Dist(set2 , 7) [ abs(7 - 0) < abs( 7-10 ) ].

So put point 4 in cluster 2.

-----------------------------------------------------------

After step1 :

Cluster 1 = { 0 , 2 , 4 }.

Cluster 2 = { 7, 10}.

New Representative of set 1 = ( 0+2+4 ) / 3 = 2

Representative of set 2 = (7 + 10) / 2 = 8.5.

STEP 2 :

For Point 0

Dist( set1 , 0) = abs(2-0) = 2

Dist( set2 , 0 ) = abs(8.5 - 0) = 8.5.

0 is closest to cluster 1 , so put it into cluster 1.

For Point 2

Dist( set1 , 2) = abs(2-2) = 0

Dist( set2 , 2 ) = abs(8.5 - 2) = 6.5.

2 is closest to cluster 1 , so put it into cluster 1.

For Point 4

Dist( set1 , 4) = abs(2-4) = 2

Dist( set2 , 4 ) = abs(8.5 - 4) = 4.5.

4 is closest to cluster 1 , so put it into cluster 1.

For Point 7

Dist( set1 , 7) = abs(2-7) = 5

Dist( set2 , 7 ) = abs(8.5 - 7) = 1.5.

7 is closest to cluster 2 , so put it into cluster 2.

For Point 10

Dist( set1 , 10) = abs(2-10) = 8

Dist( set2 , 10 ) = abs(8.5 - 10) = 1.5.

10 is closest to cluster 2 , so put it into cluster 2

----------------------------------------------

After step2 :

Cluster 1 = { 0 , 2 , 4 }.

Cluster 2 = { 7, 10}.

New Representative of set 1 = ( 0+2+4 ) / 3 = 2

Representative of set 2 = (7 + 10) / 2 = 8.5.

As, we can check , that there is no change in cluster elements.

So we can stop here.

and These are our final cluters

So Final Prototypes :

Cluster 1 = { 0 , 2 , 4 }.

Cluster 2 = { 7, 10}.

--------------------------------------End---------------------------------------

THANKS

PLEASE RATE POSITIVELY

MEANS A LOT TO ME

ANY DOUBT IN COMMENT SECTION

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote