I try to cluster a dataframe of 227 rows in 5 clusters using kmeans algorithm. Each time I run my code I got different labels and different clusters which make my analysis afterwards a bit tricky.
Someone told me to use the parameter: randomstate to have a reproductility in my results. I did. I have the same clusters but still not the same label. Is it normal? Is there a way to get the same labels ?
below my code:
Test sur 5 clusters
# Data X = df.iloc[:,1:] myseed = 10 # Modèle kmeans à 5 clusters km = KMeans(n_clusters=5, random_state=myseed, n_init=30) # Fitting du modèle aux points km = km.fit(X) y_km = km.predict(X)