Draft
Dunn Index
Score clustering by dividing the weakest inter-cluster gap by the widest within-cluster diameter.
Hook problem: the weakest gap can decide the story
Averages can hide the exact place where a clustering is fragile.
Dunn Index asks an extreme question: “How large is the closest gap between clusters, compared with the widest cluster?”
C
higher is better
First naive idea: average the distances
A distance average can look good even when one bridge point almost touches another cluster.
For some applications, that one weak gap is the part you care about.
Core invention: minimum separation over maximum diameter
This page uses a common Dunn variant:
- Inter-cluster separation is the smallest distance between any point in one cluster and any point in another cluster.
- Intra-cluster diameter is the largest distance between two points in the same cluster.
Formal version
Here, delta is the closest cross-cluster pair distance, and Delta is the largest same-cluster pair distance.
Higher Dunn is better. It becomes unavailable when the largest within-cluster diameter is zero.
Interactive preset lab
Internal clustering metric preset lab
Explanation: Three compact groups are far apart, so cohesion and separation agree.
higher is better
higher is better
lower is better
higher is better
Static no-JS fallback:
| closest cross-cluster pair | p2 - p6 |
|---|---|
| minimum gap | 4.418 |
| widest cluster | C |
| maximum diameter | 0.825 |
| Dunn | 5.358 |
Implementation sketch
function dunn(minGap: number, maxDiameter: number) {
return maxDiameter === 0 ? null : minGap / maxDiameter;
}
Complexity
This variant needs pairwise distances, so the direct implementation is O(n^2).
Common confusions
- Dunn is higher-better.
- Dunn is sensitive to outliers because it uses extremes.
- Different texts may use different inter-cluster distance variants; this page uses closest cross-cluster pair distance.
Silhouette: 0.889
CH: 251.312
DB: 0.126
Dunn: 5.358
Silhouette: 0.551
CH: 17.953
DB: 0.474
Dunn: 0.903
Silhouette: 0.62
CH: 28.707
DB: 0.446
Dunn: 0.327
Silhouette: -0.314
CH: 0.035
DB: 13.062
Dunn: 0.08
Exercises
- Which quantity is the numerator?
- Why does a bridge point reduce Dunn quickly?
- What kind of outlier can make the denominator too large?
Graph connections : Dunn Index