我正在使用此代码查找kmeans簇的弯头值。
Sum_of_squared_distances = []
K = range(1, 100)
for k in K:
km = KMeans(n_clusters=k)
km = km.fit(X)
Sum_of_squared_distances.append(km.inertia_)
情节看起来非常混乱。如何确定最佳群集数?
plt.plot(K, Sum_of_squared_distances, "bx-")
plt.xlabel("k")
plt.ylabel("Sum_of_squared_distances")
plt.title("Elbow Method For Optimal k")
plt.show()