100% found this document useful (1 vote)
4K views5 pages

K-Means Algorithm Solved Example

The K-Means algorithm is applied to a dataset with K=2 clusters using two iterations. Initial centroids are chosen as the first two data points, and Euclidean distance is used to assign data points to clusters. After two iterations, the clusters stabilize, indicating that further iterations are unnecessary.

Uploaded by

useaiu4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
4K views5 pages

K-Means Algorithm Solved Example

The K-Means algorithm is applied to a dataset with K=2 clusters using two iterations. Initial centroids are chosen as the first two data points, and Euclidean distance is used to assign data points to clusters. After two iterations, the clusters stabilize, indicating that further iterations are unnecessary.

Uploaded by

useaiu4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

How to solve K-Means Algorithm

Numerical?

Q. Apply K(=2)-Means algorithm over the data below


Where date ={ (185, 72), (170, 56), (168, 60),
(179,68), (182,72), (188,77)} up to two iterations
and show the clusters. Initially choose first two
objects as initial centroids.
Solution:
Given, number of clusters to be created (K) = 2 say c1 and c2,
number of iterations = 2 and
The given data points can be represented in tabular form as:

Data Points

also, first two objects as initial centroids:


Centroid for first cluster c1 = (185, 72)
Centroid for second cluster c2 = (170, 56)

Iteration 1: Now calculating similarity by using Euclidean


distance measure as:
Euclidean distance calculation

Representing above information in tabular form:

Distance of each data points from cluster centroids

The resulting cluster after first iteration is:


Data points cluster

Iteration 2: Now calculating centroid for each cluster:

Calculating centroid as mean of data points

Now, again calculating similarity:


Distance calculation between data points and centroids

Representing above information in tabular form.


Distance of each data points from cluster centroids

The resulting cluster after second iteration is:

Data points cluster

As we have already completed two iteration as asked by our question,


the numerical ends here.

Since, the clustering doesn’t change after second iteration, so


terminate the iteration even if question doesn’t say so.

You might also like