- Daily Dose of Data Science
- Posts
- A Visual Comparison Between Locality and Density-based Clustering
A Visual Comparison Between Locality and Density-based Clustering
The biggest limitation of locality-based clustering.

The utility of KMeans is limited to datasets with spherical clusters. Thus, any variation is likely to produce incorrect clustering.
Density-based clustering algorithms, such as DBSCAN, can be a better alternative in such cases.
They cluster data points based on density, making them robust to datasets of varying shapes and sizes.
The image depicts a comparison of KMeans vs. DBSCAN on multiple datasets.
As shown, KMeans only works well when the dataset has spherical clusters. But in all other cases, it fails to produce correct clusters.
Find more here: Sklearn Guide.
👉 If you liked this post, leave a heart react 🤍.
👉 If you love reading this newsletter, feel free to share it with friends!
Find the code for my tips here: GitHub.
Reply