Question: 1 . In this problem, you will perform K - means clustering manually, with K = 2 , on a small example with n =

1. In this problem, you will perform K-means clustering manually, with K =2, on a
small example with n =6 observations and p =2 features. The observations are as
follows.
Obs. X1 X2
164
252
343
412
511
600
(a) Plot the observations.
(b) Randomly assign a cluster label to each observation as follows:
RNGkind(sample.kind = "default")
set.seed(2)
labels <- sample(2, nrow(x), replace = T)
Report the cluster labels for each observation.
(c) Compute the centroids for each cluster.
(d) Assign each observation to the centroid to which it is closest, in terms of Eu-
clidean distance. Report the cluster labels for each observation.
(e) Update the cluster assignments via K-Means algorithm until they stop changing.
How many iterations did it take? Hint: it wont take long.
(f) Update your plot from (a), by coloring the observations according to the cluster
labels obtained.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!