Conteúdo do Curso
Cluster Analysis in Python
Cluster Analysis in Python
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
- 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.
Obrigado pelo seu feedback!
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
- 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.
Obrigado pelo seu feedback!
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
- 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.
Obrigado pelo seu feedback!
Well, I think that the model did good work. But what if we try to divide the points into 4 groups?
Tarefa
- 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.