5 Ways for Deciding Number of Clusters in a Clustering Model | Machine Learning | Python

Опубликовано: 12 Июнь 2026
на канале: Grab N Go Info
4,222
44

Deciding the optimal number of clusters is a critical step in building an unsupervised clustering model. In this tutorial, we will talk about five ways to decide the number of clusters for a clustering model in Python. You will learn:

👉 How to use the elbow method on within cluster sum of squares to decide the number of clusters?
👉 How to use the Silhouette score to decide the number of clusters?
👉 How to use the hierarchical graph to find the optimal number of clusters visually?
👉 How to use AIC and BIC for choosing the number of clusters?
👉 How to use gap statistics to decide the number of clusters?

⏰ Timecodes ⏰
0:00 - Intro
0:32 - Step 1: Import Libraries
1:37 - Step 2: Read Data
2:50 - Step 3: Dimensionality Reduction and Visualization
3:40 - Step 4: Deciding Number of Clusters Using Elbow Method (Method 1)
4:20 - Step 5: Deciding Number of Clusters Using Silhouette Score (Method 2)
5:15 - Step 6: Deciding Number of Clusters Using Hierarchical Graph (Method 3)
5:41 - Step 7: Deciding Number of Clusters Using AIC and BIC from GMM (Method 4)
6:28 - Step 8: Deciding Number of Clusters Using Gap Statistics (Method 5)
7:11 - Step 9: Which method to use for the optimal number of clusters?

❤️ Blog post with code for this video:   / 5-ways-for-deciding-number-of-clusters-in-...  
📒 Code Notebook: https://mailchi.mp/998164a71aaf/clust...
🚛 GrabNGoInfo Machine Learning Tutorials Inventory:   / grabngoinfo-machine-learning-tutorials-inv...  

🏪 Purchase data science and computer science themed products in my Amazon store: https://amzn.to/40HUTsl
🙏 Give me a tip to show your appreciation: https://www.paypal.com/donate/?hosted...
✅ Join Medium Membership: If you are not a Medium member and would like to support me as a writer (😄 Buy me a cup of coffee ☕), join Medium membership through this link:   / membership  
You will get full access to posts on Medium for $5 per month, and I will receive a portion of it. Thank you for your support!

🎞️ Playlists:    / @grabngoinfo  

🔥 Check out more machine learning tutorials on my website!
https://grabngoinfo.com/tutorials/
🛎️ SUBSCRIBE to GrabNGoInfo https://bit.ly/3keifBY
📧 CONTACT me at mailto:[email protected]
👩🏻‍💻 Follow me on LinkedIn:   / grabngoinfo  

📣 Speech software used in the video: Descript https://www.descript.com/?lmref=h7XYQw

#clustering #machinelearning #datascience #grabngoinfo