1,521 views
0 0 votes

I have a dataset with 7 labels in the target variable.

X = data.drop('target', axis=1)
Y = data['target']
Y.unique()

array(['Normal_Weight', 'Overweight_Level_I', 'Overweight_Level_II',
       'Obesity_Type_I', 'Insufficient_Weight', 'Obesity_Type_II',
       'Obesity_Type_III'], dtype=object)

km = KMeans(n_clusters=7, init="k-means++", random_state=300)
km.fit_predict(X)
np.unique(km.labels_)

array([0, 1, 2, 3, 4, 5, 6])

 

After performing KMean clustering algorithm with number of clusters as 7, the resulted clusters are labeled as 0,1,2,3,4,5,6. But how to know which real label matches with the predicted label.

In other words, I want to know how to give original label names to new predicted labels, so that they can be compared like how many values are clustered correctly (Accuracy).

Please log in or register to answer this question.

Related questions

1 1 vote
1 1 answer
2.2k
2.2k views
tofighi asked Sep 25, 2018
2,233 views
I am looking for a roadmap for choosing the right estimator in scikit-learn
2 2 votes
1 1 answer
839
839 views
cbarbisan asked Jan 31, 2019
839 views
Regarding the datacamp tutorial "Python Machine Learning: Scikit-Learn Tutorial", the author is considering the use cases that are relevant to the digits data set, so she...
0 0 votes
1 1 answer
1.3k
1.3k views
tofighi asked Feb 18, 2020
1,327 views
Is there any proper way to combine multiple classifiers and their parameter grids in one Pipeline?
1 1 vote
2 answers 2 answers
12.2k
12.2k views
kaADSS asked Jan 21, 2020
12,179 views
Hi,Since I still have confuse to use the score() and accuracy_score(), so I want to confirm my test assumption.Q1: score(), we use the split data to test the accuracy by...