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?
Tarefa
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.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 1. Capítulo 5
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Suggested prompts:
Resumir este capítulo
Explicar o código em file
Explicar por que file não resolve a tarefa
Awesome!
Completion rate improved to 3.57
Case 2: Four Distinct Clusters
Deslize para mostrar o menu
Well, I think that the model did good work. But what if we try to divide the points into 4 groups?
Tarefa
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.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Awesome!
Completion rate improved to 3.57Seção 1. Capítulo 5
single