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?
Uppgift
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.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 5
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Suggested prompts:
Sammanfatta detta kapitel
Explain code
Explain why doesn't solve task
Awesome!
Completion rate improved to 3.57
Case 2: Four Distinct Clusters
Svep för att visa menyn
Well, I think that the model did good work. But what if we try to divide the points into 4 groups?
Uppgift
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.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 5
single