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?
Tehtävä
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.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 1. Luku 5
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Suggested prompts:
Tiivistä tämä luku
Explain code
Explain why doesn't solve task
Awesome!
Completion rate improved to 3.57
Case 2: Four Distinct Clusters
Pyyhkäise näyttääksesi valikon
Well, I think that the model did good work. But what if we try to divide the points into 4 groups?
Tehtävä
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.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Awesome!
Completion rate improved to 3.57Osio 1. Luku 5
single