Case 2: Four Distinct Clusters
Well, I think that the model did good work. But what if we try to divide the points into 4 groups?
Taak
Swipe to start coding
- Import necessary libraries with their standard aliases. These are
pandas
(pd
),matplotlib.pyplot
(plt
),seaborn
(sns
), andKMeans
fromsklearn.cluster
. - Create a
KMeans
model object with 4 clusters. - Fit the
data
to themodel
. - Predict the labels for
data
. Save the result within the'prediction'
column ofdata
. - Build scatter plot for
'x'
and'y'
columns ofdata
with each point being painted with respect to the'prediction'
column.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 1. Hoofdstuk 5
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Suggested prompts:
Vat dit hoofdstuk samen
Explain code
Explain why doesn't solve task
Awesome!
Completion rate improved to 3.57
Case 2: Four Distinct Clusters
Veeg om het menu te tonen
Well, I think that the model did good work. But what if we try to divide the points into 4 groups?
Taak
Swipe to start coding
- Import necessary libraries with their standard aliases. These are
pandas
(pd
),matplotlib.pyplot
(plt
),seaborn
(sns
), andKMeans
fromsklearn.cluster
. - Create a
KMeans
model object with 4 clusters. - Fit the
data
to themodel
. - Predict the labels for
data
. Save the result within the'prediction'
column ofdata
. - Build scatter plot for
'x'
and'y'
columns ofdata
with each point being painted with respect to the'prediction'
column.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Awesome!
Completion rate improved to 3.57Sectie 1. Hoofdstuk 5
single