Question: 1 . In this problem, you will perform K - means clustering manually, with K = 2 , on a small example with n =
In this problem, you will perform Kmeans clustering manually, with K on a
small example with n observations and p features. The observations are as
follows.
Obs. X X
a Plot the observations.
b Randomly assign a cluster label to each observation as follows:
RNGkindsamplekind "default"
set.seed
labels sample nrowx 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 KMeans 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
