(a) Plot the observations. (b) Randomly assign a cluster label to each observation. You can use the np.random.choice() function to do this. Report the cluster labels for each observation.

icon
Related questions
Question
2. 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.
(a) Plot the observations.
(b) Randomly assign a cluster label to each observation. You can use the np.random.choice()
function to do this. Report the cluster labels for each observation.
Transcribed Image Text:2. 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. (a) Plot the observations. (b) Randomly assign a cluster label to each observation. You can use the np.random.choice() function to do this. Report the cluster labels for each observation.
Obs.
X1
X2
1
1
4
23
2
1
3
0
34
4
5
1
5
6
0
20
64
(c) Compute the centroid for each cluster.
(d) Assign each observation to the centroid to which it is closest, in terms of Euclidean distance.
Report the cluster labels for each observation.
(e) Repeat (c) and (d) until the answers obtained stop changing.
(f) In your plot from (a), color the observations or mark them by different markers according
to the cluster labels obtained.
Transcribed Image Text:Obs. X1 X2 1 1 4 23 2 1 3 0 34 4 5 1 5 6 0 20 64 (c) Compute the centroid for each cluster. (d) Assign each observation to the centroid to which it is closest, in terms of Euclidean distance. Report the cluster labels for each observation. (e) Repeat (c) and (d) until the answers obtained stop changing. (f) In your plot from (a), color the observations or mark them by different markers according to the cluster labels obtained.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 1 images

Blurred answer