DBSCAN
- Neighborhood
- One eps and min_samples.
Loading…
DBSCAN uses one eps for the whole table, so every neighborhood on that table is the same size. HDBSCAN builds a hierarchy of densities, so one cluster can keep a tighter neighborhood than another cluster on the same rows.
Choose whether every neighborhood uses one eps.
This is a choice, not a measured winner.
DBSCAN Clustering has no silhouette on Wine (UCI wine recognition), because that fit did not keep two groups; Silhouette is within 0.01 on Iris Flowers and Customer Segments; Noise rows show up on Iris Flowers and Wine (UCI wine recognition).
Should one cluster keep a tighter neighborhood than another?
A hierarchy of densities, instead of one eps for the whole table.
Wholesale Customers has 440 rows and six spend columns: Fresh, Milk, Grocery, Frozen, Detergents_Paper, and Delicassen. Channel and Region stay out of the fit.
DBSCAN, 440 rows, 1 cluster, 32 noise rows.
HDBSCAN, 440 rows, 2 clusters, 280 noise rows. Silhouette 0.421643.


The six spend columns are right-skewed, DBSCAN keeps 1 cluster and marks 32 rows as noise, and HDBSCAN keeps 2 clusters and marks 280 rows as noise.

The link loads the six-column sample. DBSCAN is set to eps 1.335645 and min_samples 5. HDBSCAN is set to min cluster size 5. Run is still required.
from sklearn.cluster import DBSCAN
from sklearn.preprocessing import StandardScaler
Xs = StandardScaler().fit_transform(X)
labels = DBSCAN(eps=1.335645, min_samples=5).fit_predict(Xs)
# Product HDBSCAN: min_cluster_size=5, min_samples=5, metric=euclidean.
# Features are StandardScaler-transformed before the fit.
One-epsilon DBSCAN on Iris Flowers (150 rows and 4 features) keeps 2 dense regions and flags 4 noise rows, silhouette 0.598. HDBSCAN keeps 2 stable clusters and flags 2 noise rows, silhouette 0.590. The two density fits are within 0.01 silhouette.


One-epsilon DBSCAN on Wine (UCI wine recognition) (178 rows and 13 features) keeps 1 dense regions and flags 8 noise rows, silhouette not defined. HDBSCAN keeps 2 stable clusters and flags 70 noise rows, silhouette 0.360. One of the two density fits has no silhouette, because it did not keep two dense regions.


One-epsilon DBSCAN on Customer Segments (200 rows and 5 features) keeps 2 dense regions and flags 0 noise rows, silhouette 0.608. HDBSCAN keeps 2 stable clusters and flags 0 noise rows, silhouette 0.608. The two density fits are within 0.01 silhouette.


| Dataset | Algorithm | Clusters | Noise | Silhouette | Adjusted Rand |
|---|---|---|---|---|---|
| Wholesale Customers | DBSCAN | 1 | 32 | — | — |
| Wholesale Customers | HDBSCAN | 2 | 280 | 0.422 | — |
| Iris Flowers | DBSCAN Clustering | 2 | 4 | 0.598 | 0.552 |
| Iris Flowers | HDBSCAN Clustering | 2 | 2 | 0.590 | 0.564 |
| Wine (UCI wine recognition) | DBSCAN Clustering | 1 | 8 | not defined | not defined |
| Wine (UCI wine recognition) | HDBSCAN Clustering | 2 | 70 | 0.360 | 0.266 |
| Customer Segments | DBSCAN Clustering | 2 | 0 | 0.608 | 0.330 |
| Customer Segments | HDBSCAN Clustering | 2 | 0 | 0.608 | 0.330 |
DBSCAN uses one eps for the whole table, so every neighborhood on that table is the same size. HDBSCAN builds a hierarchy of densities, so one cluster can keep a tighter neighborhood than another cluster on the same rows.
This is a choice, not a measured winner.
The six spend columns are right-skewed, DBSCAN keeps 1 cluster and marks 32 rows as noise, and HDBSCAN keeps 2 clusters and marks 280 rows as noise.
Method: StandardScaler, drop constant columns. Code version 3e4afc4b4352 (scripts/seo/build_explore_artifacts.py). scikit-learn 1.4.2. Seed 42. Both algorithms were fit on the same scaled table. Where a label column exists, it was held out of the fit and scored with adjusted Rand. Iris Flowers: UCI Machine Learning Repository, Iris (Fisher, 1936). License: CC BY 4.0. Wine (UCI wine recognition): UCI Machine Learning Repository, wine recognition. License: CC BY 4.0. Customer Segments: Synthetic customer records bundled with this site. License: Generated for demos; no external license.
Results computed, published, and last updated on 2026-11-02.
The comparison sentences are filled from these published runs by a fixed template, so the scores can be checked against the same datasets in the tool.
Maintainer: nikolaou1982.
Contact: nick1982100@gmail.com.