(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.
(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.
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.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F3d49a1bf-def0-472f-94db-660c9693a140%2Fa258c975-d9d4-4fe1-8dc5-5579f20d7344%2Fj4fiv7_processed.jpeg&w=3840&q=75)
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.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F3d49a1bf-def0-472f-94db-660c9693a140%2Fa258c975-d9d4-4fe1-8dc5-5579f20d7344%2F1qtylg4_processed.jpeg&w=3840&q=75)
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
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)