我有 78 行和 131 列,我需要将 python matplotlib 中每个集群的平均轮廓分数绘制为折线图。我做了这些代码并且工作得很好,但我不知道如何绘图?
mean = KMeans(n_clusters = 2)
kmean.fit(Data1)
centroids = kmean.cluster_centers_
print("Shape of Centroids Array: " + str(centroids.shape))
print()
print(centroids)
from collections import Counter
labels = kmean.labels_
c = Counter(labels)
print(c.most_common())
Record_array =Data1.values
print(Record_array)
mean_sihouette_score = ss(Record_array, labels)
print(mean_sihouette_score)
for cluster_number in range(0,2):
print("Cluster {} contains {} samples with percentage of {:.2f}%".format(cluster_number, c[cluster_number], c[cluster_number]/sum(c.values()) *100))