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?
Tâche
Swipe to start coding
- Import necessary libraries with their standard aliases. These are
pandas(pd),matplotlib.pyplot(plt),seaborn(sns), andKMeansfromsklearn.cluster. - Create a
KMeansmodel object with 4 clusters. - Fit the
datato themodel. - Predict the labels for
data. Save the result within the'prediction'column ofdata. - Build scatter plot for
'x'and'y'columns ofdatawith each point being painted with respect to the'prediction'column.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 1. Chapitre 5
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Suggested prompts:
Résumer ce chapitre
Expliquer le code dans file
Expliquer pourquoi file ne résout pas la tâche
Awesome!
Completion rate improved to 3.57
Case 2: Four Distinct Clusters
Glissez pour afficher le menu
Well, I think that the model did good work. But what if we try to divide the points into 4 groups?
Tâche
Swipe to start coding
- Import necessary libraries with their standard aliases. These are
pandas(pd),matplotlib.pyplot(plt),seaborn(sns), andKMeansfromsklearn.cluster. - Create a
KMeansmodel object with 4 clusters. - Fit the
datato themodel. - Predict the labels for
data. Save the result within the'prediction'column ofdata. - Build scatter plot for
'x'and'y'columns ofdatawith each point being painted with respect to the'prediction'column.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 1. Chapitre 5
single