शुरू करेंमुफ़्त में शुरू करें

अलग-अलग क्लस्टर्स पर Elbow method

चलिए comic con डेटासेट का उपयोग करके देखते हैं कि स्पष्ट, अच्छे-से परिभाषित क्लस्टर्स वाले डेटासेट पर elbow plot कैसा दिखता है। अभ्यास आगे बढ़ाने से पहले आप डेटा पॉइंट्स को विज़ुअलाइज़ करना चाहेंगे।

डेटा एक pandas DataFrame comic_con में संग्रहीत है। x_scaled और y_scaled वे कॉलम नाम हैं जिनमें किसी समय बिंदु पर लोगों के standardized X और Y coordinates हैं।

यह अभ्यास पाठ्यक्रम का हिस्सा है

Python में क्लस्टर विश्लेषण

पाठ्यक्रम देखें

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

distortions = []
num_clusters = range(1, 7)

# Create a list of distortions from the kmeans function
for i in ____:
    cluster_centers, distortion = ____
    distortions.append(distortion)

# Create a DataFrame with two lists - num_clusters, distortions
elbow_plot = pd.DataFrame({'num_clusters': ____, 'distortions': ____})

# Creat a line plot of num_clusters and distortions
sns.lineplot(x=____, y=____, data = ____)
plt.xticks(num_clusters)
plt.show()
कोड संपादित करें और चलाएँ