'how do I number the kmeans cluster output gradually in python?
I have some data that try to cluster them using Kmeans. I have six clusters and the value of these clusters' member increase gradually, but when I plot the output, the number of clusters is not in order. I attached the image below. as you can see the highest cluster number is 0 but I want to have 5 instead of 0 for the top cluster. could you please tell me how can I do this? my code is here:
psnr_bitrate_720=np.vstack([np.loadtxt(path, dtype='float') for path in glob.iglob(r'E:/720/*.txt')])
scaler = StandardScaler()
scaled_features_720 = pd.DataFrame((psnr_bitrate_720))
kmeans = KMeans(init="random",n_clusters=6,n_init=10,max_iter=300,random_state=42)
kmeans.fit(scaled_features_720)
scaled_features_720['cluster'] = kmeans.predict(scaled_features_720)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

