Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Additional Practice Questions

1. Consider the following dataset with four data points: (2, 5), (3, 4), (3, 3), (4, 5). Apply K Means
clustering with K = 2, starting with the centroids at (2, 5) and (4, 5). What are the final centroids after
one iteration?

2. Use the same dataset as in question 1, but apply K Means clustering with K = 3, starting with the
centroids at (2, 5), (3, 4), and (4, 5). What are the final centroids after two iterations?

3. Consider the following dataset with six data points: (1, 1), (1, 2), (3, 3), (4, 5), (5, 5), (6, 4). Apply K
Means clustering with K = 3, starting with the centroids at (1, 1), (3, 3), and (6, 4). What are the final
centroids after two iterations?

4. Use the same dataset as in question 3, but apply K Means clustering with K = 2, starting with the
centroids at (1, 1) and (6, 4). What are the final centroids after three iterations?

5. Consider the following dataset with four data points: (1, 2), (2, 4), (3, 3), (5, 2). Apply K Means
clustering with K = 2, starting with the centroids at (1, 2) and (5, 2). What are the final centroids after
one iteration?

6. Suppose we have a data set with 10 data points and we want to apply K-means clustering with K=3.
After the first iteration, the cluster centroids are at (2,4), (6,9), and (10,15). Suppose the data point (4,7)
is assigned to the cluster with centroid (2,4). What are the new cluster centroids after reassigning the
data point to the correct cluster?

Solution

Q1. To apply K-Means clustering with K = 2 starting with the centroids at (2, 5) and (4, 5), we first calculate the
distance of each point from both centroids and assign each point to the closest centroid. Then, we calculate the
mean of all the points assigned to each centroid and update the centroid positions.

Here's how one iteration of K-Means clustering with K = 2 will look like: Calculate the distance of each point
from both centroids:

Point Distance from (2, 5) Distance from (4, 5) Closest centroid

(2, 5) 0 2 (2, 5)

(3, 4) 1 1 (4, 5)

(3, 3) 2 2 (4, 5)

(4, 5) 2 0 (4, 5)

Update centroid positions:

The mean of the points assigned to (2, 5) is (2, 5), which is the same as the current position of this centroid. The
mean of the points assigned to (4, 5) is (3.33, 4), which is the new position of this centroid. Therefore, after one
iteration, the final centroids are (2, 5) and (3.33, 4).

Q2.

To apply K-Means clustering with K = 3 starting with the centroids at (2, 5), (3, 4), and (4, 5), we follow a
similar process as in question 1, but with three centroids. Here's how two iterations of K-Means clustering with
K = 3 will look like:

Iteration 1: Calculate the distance of each point from all three centroids:
Point Distance from (2, 5) Distance from (3, 4) Distance from (4, 5) Closest centroid

(2, 5) 0 1.41 2 (2, 5)

(3, 4) 1 0.24 1 (3, 4)

(3, 3) 2 1.41 1 (4, 5)

(4, 5) 2 1.41 0 (4, 5)

Update centroid positions:

The mean of the points assigned to (2, 5) is (2, 5), which is the same as the current position of this centroid. The
mean of the points assigned to (3, 4) is (3, 3.5), which is the new position of this centroid. The mean of the
points assigned to (4, 5) is (3.5, 4), which is the new position of this centroid.

Iteration 2:

Calculate the distance of each point from all three centroids:

Point Distance from (2, 5) Distance from (3, 3.5) Distance from (3.5, 4) Closest centroid

(2,
5) 0 1.8 2.12 (2, 5)

(3,
4) 1 0.5 0.5 (3, 3.5)

(3,
3) 2 0.5 0.71 (3, 3.5)

(4,
5) 2 1.12 0.5 (3.5, 4)

Update centroid positions:

The mean of the points assigned to (2, 5) is (2, 5), which is the same as the current position of this centroid. The
mean of the points assigned to (3, 3.5) is (3, 3.5), which is the same as the current position of this centroid. The
mean of the points assigned to (3.5, 4) is (4, 5), which is the new position of this centroid.

Therefore, after two iterations, the final centroids are (2, 5), (3, 3.5), and (4, 5).

You might also like