समान (uniform) डेटा पर Elbow विधि
पिछले अभ्यास में, आपने स्पष्ट रूप से परिभाषित क्लस्टरों वाले डेटा पर एक elbow प्लॉट बनाया था। अब देखते हैं कि समान रूप से वितरित बिंदुओं वाले डेटासेट पर elbow प्लॉट कैसा दिखता है। आगे बढ़ने से पहले आप चाहें तो डेटा पॉइंट्स दिखा सकते हैं।
डेटा एक pandas DataFrame uniform_data में संग्रहीत है। x_scaled और y_scaled उन कॉलम के नाम हैं जिनमें बिंदुओं के मानकीकृत X और Y कॉर्डिनेट्स हैं।
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में क्लस्टर विश्लेषण
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
distortions = []
num_clusters = range(2, 7)
# Create a list of distortions from the kmeans function
for i in ____:
cluster_centers, distortion = ____
____.append(____)
# Create a DataFrame with two lists - number of clusters and distortions
elbow_plot = pd.DataFrame({'num_clusters': ____, 'distortions': ____})
# Creat a line plot of num_clusters and distortions
sns.____(x=____, y=____, data=____)
plt.xticks(num_clusters)
plt.show()