Comparative Clustering Evaluation: Internal vs. External Metrics

Benchmarking K-Means, Ward Agglomerative Clustering, and DBSCAN across 9 internal and Hungarian-matched external metrics on the Iris and Wine datasets.

Key Performance Metrics

Best Partition (Wine) 96.6% K-Means accuracy (ARI = 0.898, Weighted F1 = 0.966)
Metric Paradox 0.656 vs 0.442 DBSCAN highest Silhouette yet lowest ARI on Iris
Noise Dropped 22.7–23.6% DBSCAN unlabeled points (34/150 Iris, 42/178 Wine)
Evaluation Suite 9 Metrics 3 internal + 6 Hungarian-matched external indices

Problem & Objective

Evaluating unsupervised clustering algorithms is notoriously tricky because internal geometric indices (Silhouette, Davies-Bouldin, Calinski-Harabasz) reward compact, well-separated cores without knowing whether they match true classes. This study compares centroid-based (K-Means), hierarchical (Ward Agglomerative), and density-based (DBSCAN) clustering on standardized Iris (4D) and Wine (13D) datasets using 3 internal metrics and 6 external metrics — including custom Hungarian optimal label assignment (linear_sum_assignment) for Purity, Weighted Accuracy, Weighted F1, and Weighted F0.5.

Technologies & Tools

Python scikit-learn SciPy NumPy Pandas Matplotlib

Date

May 2026

Course

Machine Learning (CIS-621)

Dataset

UCI Iris (150×4) & Wine (178×13)

Findings

Key observations, empirical takeaways, and analytical conclusions.

  • Internal metrics can be actively misleading when comparing density-based and partitioning algorithms: DBSCAN scored highest on Silhouette (0.656 Iris, 0.331 Wine) and lowest on Davies-Bouldin (0.494, 1.182) while scoring worst on every external metric by discarding ~23% of boundary points as noise and merging two classes.
  • Higher dimensionality compresses Silhouette scores even for near-perfect clusters: K-Means recovered 96.63% of true Wine labels (ARI = 0.8975) despite a modest 0.2849 Silhouette in 13D space.
  • K-Means and Ward Agglomerative performed closely on 4D Iris (83.3% vs. 82.7% accuracy; Ward slightly ahead on NMI 0.676 vs. 0.660), while K-Means pulled ahead cleanly on 13D Wine (96.6% vs. 92.7% accuracy, +0.108 ARI).
  • Optimal label mapping via the Hungarian algorithm (linear_sum_assignment) is essential before computing cluster accuracy or F-beta scores because cluster IDs are arbitrary permutations of class labels.

Results & Analysis

Internal vs. external metric comparison, PCA projections, silhouette profile, and Ward dendrogram.

Side-by-side Silhouette, ARI, NMI, Purity, and Weighted F1 scores highlighting how DBSCAN wins Silhouette on both datasets while trailing K-Means and Ward Agglomerative on every ground-truth metric. Tap to zoom

Side-by-side Silhouette, ARI, NMI, Purity, and Weighted F1 scores highlighting how DBSCAN wins Silhouette on both datasets while trailing K-Means and Ward Agglomerative on every ground-truth metric.

PCA projections (95.9% variance retained) comparing ground truth against K-Means, Ward Agglomerative, and DBSCAN, illustrating how DBSCAN merges Versicolor and Virginica while marking 34 boundary samples as noise. Tap to zoom

PCA projections (95.9% variance retained) comparing ground truth against K-Means, Ward Agglomerative, and DBSCAN, illustrating how DBSCAN merges Versicolor and Virginica while marking 34 boundary samples as noise.

Per-sample silhouette coefficients (mean 0.460) alongside the truncated Ward-linkage dendrogram showing a clean 3-cluster cut at distance d = 10. Tap to zoom

Per-sample silhouette coefficients (mean 0.460) alongside the truncated Ward-linkage dendrogram showing a clean 3-cluster cut at distance d = 10.

Copyright © 2026 Hafiz Sani.

Drag to pan chart
Enlarged visual