DBSCAN (Density-Based Spatial Clustering of Applications with Noise) is a Clustering algorithm that groups together data points based on density. It is particularly useful when K-means doesn’t work well, such as in datasets with complex shapes or when there are outliers.
- Used when K-means doesn’t work: DBSCAN handles datasets with irregular cluster shapes and is not sensitive to outliers like K-means.
- When you have nesting of clusters: It can identify clusters of varying shapes and sizes without needing to predefine the number of clusters, unlike K-means.
- Groups core points to make clusters: DBSCAN identifies core points, which have many nearby points, and groups them together.
- Can identify Outliers: It detects noise points (outliers) that don’t belong to any cluster.
Python Example:
This will cluster the data and visualize it, highlighting core points and marking outliers as separate clusters.