📅  最后修改于: 2022-03-11 14:45:22.439000             🧑  作者: Mango
pca = PCA(n_components=n_digits)
X_pca = pca.fit(inputs).transform(inputs)
kmeans = KMeans(n_clusters=n_digits, init=pca.components_, n_init=1)
predict = kmeans.fit(inputs).predict(inputs)
stats = clusters_stats(predict, Y)
purity = clusters_purity(stats)
print("Plotting an extract of the 10 clusters, overall purity: %f" % purity)
#plot_clusters(predict, Y, stats)
print(pca.components_)