Dunn Index
When you cluster data, you want two things at once: points inside each cluster should be close together, and different clusters should be clearly apart. The Dunn Index is a score built around exactly that idea, so it gives a quick sense of whether a clustering looks clean or muddled.
What it measuresThe Dunn Index compares cluster separation to cluster compactness. In plain terms, it takes:
- the smallest distance between any two clusters, and
- divides it by the largest diameter of any cluster — the spread of the worst, loosest cluster.
A higher Dunn Index is better. It means even the closest pair of clusters is still reasonably far apart, while even the messiest cluster is still fairly tight. A low value means clusters overlap, stretch out too much, or both.
Why it mattersIn unsupervised learning, there is no ground-truth label telling you whether your clustering is good. The Dunn Index gives an internal validation signal using only the data and the assigned clusters. That makes it useful when comparing results from algorithms like K-means, agglomerative clustering, or different choices of k. For example:
- In customer segmentation, a higher Dunn score suggests groups are more distinct and easier to act on.
- In document clustering, it indicates topics are better separated instead of blending together.
- In anomaly analysis, a low score can reveal that “normal” groups are poorly formed, making outliers harder to detect reliably.
The Dunn Index is sensitive to outliers because one unusually wide cluster can shrink the score sharply. It also depends on how distance is defined, such as Euclidean or cosine distance. That is why practitioners rarely use it alone; they compare it with metrics like the Silhouette Score or Davies–Bouldin Index. In Python, you may need a custom implementation or a clustering-validity package, since it is less commonly built in than silhouette scoring in scikit-learn.
Dunn Index is an internal clustering validity metric defined as the ratio of the smallest distance between points in different clusters to the largest diameter within any cluster. Higher values indicate clusters that are both well separated and compact. It matters because it lets unsupervised learning compare clustering results without ground-truth labels and helps select models or numbers of clusters that avoid overlap and excessive spread.
Imagine sorting a box of mixed buttons into piles. A good sort means each pile is tight and tidy, and the piles are clearly apart from each other. The Dunn Index is a score that checks exactly that for AI clustering, where a system groups similar things without being told the right answers.
It rewards clusters that are compact—items in the same group are close together—and well separated—different groups are far apart. A higher Dunn Index usually means cleaner, more meaningful grouping. It matters because in unsupervised learning there often isn’t an answer key, so this score helps judge whether the discovered groups actually look sensible.