Check the Quality
Now that we have trained our clustering algorithm we have to evaluate its performances to assess the results.
Methods description
.labels_
: This attribute of theKMeans
object contains the cluster labels assigned to each data point after fitting the KMeans algorithm to the data;y == labels
: This is a comparison operation that checks element-wise equality between two arraysy
andlabels
, resulting in a boolean array;correct_labels
: This variable stores the count of data points that were correctly labeled, i.e., assigned to the correct cluster.
Uppgift
Swipe to start coding
- Compare the
correct_labels
with the predicted ones. - Print the results.
Lösning
Mark tasks as Completed
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 9
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:
Ställ mig frågor om detta ämne
Sammanfatta detta kapitel
Visa verkliga exempel
Awesome!
Completion rate improved to 9.09
Check the Quality
Now that we have trained our clustering algorithm we have to evaluate its performances to assess the results.
Methods description
.labels_
: This attribute of theKMeans
object contains the cluster labels assigned to each data point after fitting the KMeans algorithm to the data;y == labels
: This is a comparison operation that checks element-wise equality between two arraysy
andlabels
, resulting in a boolean array;correct_labels
: This variable stores the count of data points that were correctly labeled, i.e., assigned to the correct cluster.
Uppgift
Swipe to start coding
- Compare the
correct_labels
with the predicted ones. - Print the results.
Lösning
Mark tasks as Completed
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 9