Paper · 2016-12-26 · cs.LG, stat.ML
Clustering Algorithms: A Comparative Approach
Benchmark, not a new method: compares seven R clustering algorithms (k-means, clara, agnes, EM, hcmodel, spectral, hddc subspace) on 270 synthetic datasets with ARI, Jaccard, Fowlkes-Mallows and NMI. Spectral clustering is best at default settings (ARI 65.80% averaged). Tuning one parameter or random search over all parameters improves several methods.
k-means clusteringSpectral clusteringClustering evaluationHyperparameter optimizationclusteringbenchmarkevaluationunsupervised-learning
AI-compiled by claude-haiku-5-5 on 2026-10-18, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.
In plain words
Clustering methods sort unlabeled data into groups. There are many of them, and they each come with settings that someone has to pick. This paper asks which of seven common clustering methods, all from the R language, gives the best groups. It answers with a large set of made-up datasets whose true groups are known, so every method can be scored against the answer.
The authors test three situations. First, each method runs with its out-of-the-box settings. Second, one setting is changed at a time. Third, all settings are changed together at random. The defaults are not always good: a spectral method does best with defaults, but a few random tweaks help several other methods a lot. The paper is a practical guide for someone who uses clustering but is not a specialist.
TL;DR
- Compares seven R clustering methods on 270 synthetic datasets, scored by four agreement indices (Jaccard, ARI, Fowlkes-Mallows, NMI) §4.2 tab. 1.
- With default settings, the spectral method has the highest average ARI (65.80%) and hierarchical clustering the lowest (24.81%) tab. 2.
- Random search over all parameters helps EM and hierarchical clustering most on the two-class, two-feature set tab. 5. EM and hierarchical also gain strongly on the 10-feature sets tab. 7 tab. 8; most methods gain little on DB10C2F tab. 6.
- It is a benchmark, not a method to implement. Its main use is the data generator and the evaluation protocol, which are underspecified (see Pitfalls).
Problem
Clustering results depend on the method, on its parameters and on the data. Users often run software defaults without tuning, and parameter search is expensive and can overfit §1. The paper asks how the default configurations of common R clustering implementations perform, how sensitive each method is to single parameters, and whether random parameter sampling improves results §1. Earlier comparisons use real data, artificial data or both §2. This paper uses only artificial data with controlled properties, so many scenarios can be run §1 §4.1.
Method
The study has three parts: a dataset generator §4.1, a set of external agreement indices §4.2, and three evaluation protocols §5.
Algorithms. Seven methods, each with one R function tab. 1:
k-means (kmeans, stats), clara (clara, cluster), hierarchical (agnes, cluster),
EM (mstep/estep, mclust), hcmodel (hc, mclust), spectral (specc, kernlab)
and subspace (hddc, HDclassif) tab. 1 §3. The paper describes each method
in words §3; no pseudocode is given for any of them, so the R functions are the
reference.
Dataset generator §4.1. Based on Hirschberger et al. §4.1:
- Choose the number of classes C, features F, objects per class Ne and the separation parameter α §4.1.
- For each class, build a random F×F matrix R = G Gᵀ, which is guaranteed to be positive semi-definite §4.1. The paper says the entries follow a normal distribution after a moment-matching step from Hirschberger et al., but the moments are not given §4.1.
- Draw Ne points from the class, divide by α, and translate by a shift s_i drawn uniformly from [−1, 1] §4.1.
- α is tuned per dataset so that no algorithm reaches 0% or 100% accuracy §4.1.
The pseudocode below is our reading of steps 1–3. Parts the paper does not state are marked.
# Artificial dataset generator [§4.1]
# Input: C classes, F features, Ne objects per class, separation alpha
# Output: points (C * Ne, F), labels (C * Ne)
def generate_dataset(C, F, Ne, alpha):
# Build a valid covariance per class: R = G G^T [§4.1]
# Entry distribution and moments of G: not stated [§4.1]
for each class i in range(C):
G = random_matrix(F, F)
covariance_i = G @ G.T # (F, F)
# Sample Ne objects from the class [§4.1]
# Mean of the Gaussian: not stated
points_i = sample_gaussian(covariance_i, Ne)
# Scale by 1/alpha and shift by s_i ~ U[-1, 1] [§4.1]
# Scalar or per-feature shift: not stated
shift_i = uniform(-1, 1)
points_i = points_i / alpha + shift_i
return stack(points), labelsAgreement indices §4.2. Build a and b and c from pair counts between the reference partition U and the found partition V eq. 1–3:
- a: pairs together in both U and V eq. 1.
- b: pairs together in U but split in V eq. 2.
- c: pairs split in U but together in V eq. 3.
Then the four indices:
- Jaccard J = a / (a + b + c) eq. 4.
- Adjusted Rand index (ARI) eq. 5.
- Fowlkes–Mallows FM = a / sqrt((a+b)(a+c)), written in the paper as a·√(a+b)·√(a+c) / ((a+b)(a+c)) eq. 6.
- Normalized mutual information NMI = I(C,T) / sqrt([H(C), H(T)]) eq. 7. See Pitfalls for the notation.
Protocols §5:
- Default parameters: each method runs with its R default settings §5.1. Default K is set to the true number of classes [supp. S1].
- One-dimensional: vary one parameter at a time, others at default §5.2. Summary statistics: mean gain ⟨S⟩ eq. 8, max gain max S eq. 9 and standard deviation ΔS eq. 10.
- Multi-dimensional: for each method draw 500 parameter sets, each parameter uniform in bounds [P_min, P_max] taken from the one-dimensional results §5.3. Summaries are the share of draws that beat the default (p-value), the mean ⟨R⟩, standard deviation ΔR and maximum max R of the gains among improved draws §5.3.
# Random parameter search for one method [§5.3]
# Input: bounds (P_min, P_max) per parameter, default score, dataset
# Output: p-value (%), mean/std/max gain over improved draws
def random_search(method, dataset, bounds, default_ari):
# Draw 500 parameter sets, uniform inside the bounds [§5.3]
gains = []
for draw in range(500):
params = sample_uniform(bounds)
# Gain = ARI with the draw minus ARI with defaults [§5.3]
ari = score(method(dataset, params), dataset.labels)
gains.append(ari - default_ari)
# p-value = share of draws that improve on defaults [§5.3]
improved = [g for g in gains if g > 0]
p_value = 100 * len(improved) / len(gains)
# <R>, Delta R and max R over the improved draws [§5.3]
return p_value, mean(improved), std(improved), max(improved)Hyperparameters
Dataset settings §4.1 §5.2. Default settings of each algorithm [supp. S1]. The experiments set K to the true number of classes when a method has no default for it [supp. S1].
| Name | Value | Where | Notes |
|---|---|---|---|
| Classes C | {2, 10, 50} | §4.1 | |
| Features F | {2, 10, 50} | §4.1 | |
| Objects per class Ne | {5, 50, 100} | §4.1 | constant within a dataset |
| Realizations per (C, F, Ne) | 10 | §4.1 | 27 × 10 = 270 datasets |
| Separation α | tuned per dataset | §4.1 | target: no method at 0% or 100%; only four values stated |
| α for one-dimensional runs | DB2C2F 2.5; DB10C2F 4.3; DB2C10F 1.16; DB10C10F 1.75 | §5.2 | |
| α examples in figure | (C, Ne, α): (2,100,3.3), (2,100,2.3), (10,50,4.3), (10,50,6.3) | fig. 2 | illustration only |
| Random draws per method | 500 | §5.3 | |
| Random parameter bounds | not stated | §5.2 §5.3 | derived from one-dimensional results; values not listed |
| k-means iter.max | 10 | [supp. S1] | default |
| k-means nstart | 1 | [supp. S1] | default |
| k-means algorithm | "Hartigan-Wong" | [supp. S1] | default |
| k-means centers (K) | true C | [supp. S1] | set by the experiment |
| clara metric | "euclidean" | [supp. S1] | default |
| clara samples | 5 | [supp. S1] | default |
| clara sampsize | min(N, 40 + 2k) | [supp. S1] | default |
| clara rngR | FALSE | [supp. S1] | default |
| hierarchical metric | "Euclidean" | [supp. S1] | default |
| hierarchical method | "average" (UPGMA) | [supp. S1] §5.2 | default; gives unbalanced clusters §5.2 |
| hierarchical par.method | 0 | [supp. S1] | default |
| EM z | "random" | [supp. S1] | mstep default |
| EM modelName | "VII" | [supp. S1] | mstep and estep default |
| hcmodel modelName | "VII" | [supp. S1] | default |
| hcmodel use | "VARS" | [supp. S1] | default |
| hcmodel G (K) | true C | [supp. S1] | set by the experiment |
| spectral kernel | "rbfdot" | [supp. S1] | default |
| spectral kpar | "automatic" | [supp. S1] | default |
| spectral nystrom.sample | N_b / 6 | [supp. S1] | default |
| spectral iter | 200 | [supp. S1] | default |
| subspace model | "akjbkQkdk" or 1 | [supp. S1] | 14 models in hddc |
| subspace k | BIC selection in (1, 10] by default | [supp. S1] | conflicts with "k = true C" [supp. S1]; see Pitfalls |
| subspace algo | "EM" | [supp. S1] | default; also CEM, SEM |
| subspace init | "kmeans" | [supp. S1] | default; also random, param, mini-em |
| subspace mini.nb | (5, 10) | [supp. S1] | used with mini-em |
Results
Author-reported. Setup: 270 synthetic datasets §4.1, seven R implementations tab. 1, four agreement indices §4.2, R default parameters unless stated. The paper does not give the R version.
Average ARI per method, over all datasets, with default parameters tab. 2, ARI block, MAcc column:
| Method | Mean ARI (MAcc) | Source |
|---|---|---|
| spectral | 65.80% | tab. 2 |
| subspace | 58.58% | tab. 2 |
| k-means | 52.19% | tab. 2 |
| clara | 49.84% | tab. 2 |
| hcmodel | 43.53% | tab. 2 |
| EM | 34.08% | tab. 2 |
| hierarchical | 24.81% | tab. 2 |
Summary of best ARI values, DB2C2F and DB10C2F tab. 9:
| Algorithm | DB2C2F ARI_def | DB2C2F ARI_best_p | DB2C2F ARI_best_r | DB10C2F ARI_def | DB10C2F ARI_best_p | DB10C2F ARI_best_r |
|---|---|---|---|---|---|---|
| EM | 32.2 | 64.4 | 69.0 | 38.4 | 45.4 | 51.4 |
| spectral | 37.2 | 54.1 | 59.0 | 45.4 | 48.0 | 52.0 |
| clara | 51.1 | 54.0 | 60.0 | 46.2 | 47.5 | 51.0 |
| hcmodel | 54.0 | 60.0 | 63.0 | 47.1 | 48.4 | 49.0 |
| k-means | 48.1 | 51.9 | 55.0 | 45.2 | 47.9 | 49.0 |
| hierarchical | 18.0 | 57.2 | 63.0 | 40.5 | 46.5 | 49.0 |
Summary of best ARI values, DB2C10F and DB10C10F tab. 10:
| Algorithm | DB2C10F ARI_def | DB2C10F ARI_best_p | DB2C10F ARI_best_r | DB10C10F ARI_def | DB10C10F ARI_best_p | DB10C10F ARI_best_r |
|---|---|---|---|---|---|---|
| subspace | 89.9 | 100.0 | 100.0 | 86.1 | 89.1 | 99.3 |
| EM | 23.4 | 100.0 | 100.0 | 40.9 | 91.6 | 100.0 |
| spectral | 82.4 | 88.1 | 90.0 | 70.9 | 82.3 | 87.3 |
| clara | 53.0 | 61.0 | 70.0 | 51.9 | 57.6 | 68.0 |
| hcmodel | 34.2 | 51.3 | 70.0 | 54.2 | 61.5 | 64.0 |
| k-means | 36.6 | 53.5 | 60.0 | 52.0 | 57.8 | 60.0 |
| hierarchical | 0.0 | 43.7 | 80.0 | 13.8 | 61.5 | 68.0 |
Headline claims, as stated by the authors:
- With default parameters, spectral averages best across the four indices; the paper reports a margin "of at least 10%" §5.1. See Pitfalls for the check.
- Kruskal–Wallis: no significant difference between methods for F = 2 (p = 0.07, χ² = 10.26); significant for F = 10 (p = 4.4×10⁻⁶) and F = 50 (p = 1.4×10⁻⁶) §5.1.
- One-dimensional: EM
modelNamegives ⟨S⟩ = 10.75% on DB2C2F; spectralkpargives 7.36% §5.2 tab. 3. On DB2C10F, hierarchicalmethodgives 8.76% and EMmodelName18.80% tab. 4. - Multi-dimensional, DB2C2F: EM p-value 68.1%, mean gain 22.1%; hierarchical mean gain 30.6% tab. 5. DB10C2F: EM p-value 76.5%, k-means 77.7% tab. 6. DB2C10F: EM mean gain 30.1%, hierarchical 25.9% tab. 7. DB10C10F: EM mean gain 17.1%, hierarchical 32.1% tab. 8.
- Changing K: underestimating the number of classes was worse than overestimating it, for all methods §5.2 §6. fig. 5 shows this.
Paper vs code
No official code. The paper gives no repository or project page, and the arXiv metadata we hold has no comments field. Searched: (1) the paper and metadata for links, none found; (2) GitHub repository search for "clustering algorithms comparative R" and for "clustering chcomin" (the corresponding author's account), with no repository by an author; (3) the first 100 repositories of that account, with no comparison repository visible. The account's listing was truncated at the end, so this search is not exhaustive.
Pitfalls
- NMI notation. The paper writes NMI = I(C,T) / sqrt([H(C), H(T)]) eq. 7. The bracket is ambiguous and the paper does not say whether it means the geometric mean of H(C) and H(T). Check the reference the paper cites for NMI §4.2 before implementing eq. 7.
- Gain statistics are mislabelled in the caption. Table captions list ⟨S⟩, max S and ΔS as "average, standard deviation and maximum difference" tab. 3 tab. 4, which reverses the order of max S and ΔS. The definitions in eq. 9 and eq. 10 are authoritative. The text does not say whether the standard deviation is the sample or population form.
- Subspace K is contradictory. The supplement says that where a method has
no default K, K is set to the true number of classes [supp. S1]. For
hddc, it says K is chosen by maximum BIC in the default interval (1, 10] [supp. S1]. The paper does not say which was used in the experiments. - Defaults used the true K. Default-parameter results set K to the true number of classes [supp. S1], which an applied user would not know. Results for mis-specified K are reported separately in §5.2 fig. 5.
- Generator details are missing. The moments used to build G, the distribution of the Gaussian mean, the sample size of covariances and the rule for choosing α are all not stated §4.1. The shift s_i is written as one value per class; whether it is a scalar or a vector is not stated §4.1. Reproducing the 270 datasets needs the original code, which is not available.
- Dataset naming. "DB2F" etc. pools all classes and object counts, while a dataset name like DB2C10F fixes C and F and uses Ne = 50 §4.1. Keep the pooled and fixed cases apart when reproducing.
- "At least 10%" claim. The margin over the next method is at least 10 points for NMI (smallest margin 12.49, against k-means) tab. 2. For ARI, Jaccard and FM, the margin over subspace is 7.22, 3.45 and 3.56 points tab. 2. The paper does not state whether margins are in percentage points or relative terms.
- Undefined MAcc column. Table 2 has a last column "MAcc" that the text describes only as the average performance of each algorithm tab. 2 §5.1. Assume it is the mean over the 270 datasets; the text does not confirm this.
- Parameter sweep values and bounds are not listed. The swept values in §5.2 and the bounds [P_min, P_max] used for random sampling in §5.3 are not stated. Random-search results cannot be matched without them.
- Seeds and repetitions. The number of random seeds per parameter set, the
R version and the seed handling are not stated. Several methods are random
(EM
z, k-meansnstart, subspaceinit), so single-run results may vary. - Text vs table, small mismatch. §5.2 says the subspace losses from
min.individualsandmodelsare about −20%. The tables give −26.9 and −22.44 on DB2C10F and DB10C10F tab. 4. Use the tables. - Hierarchical defaults. The default
methodis "average" (UPGMA), which produced very unbalanced clusters and poor accuracy on DB10C10F §5.2. Its default ARI on DB2C10F is 0.0 tab. 10. - Costs the abstract hides. The study ran 500 random parameter sets per method per dataset §5.3, and one-dimensional sweeps over several parameters tab. 3 tab. 4. Reproducing the full study is expensive.
Lineage
- Builds on: Hirschberger et al. dataset generator, with a normal-distribution choice for the covariance entries §4.1. The generator is not a card in this wiki.
- Related approaches named in the paper: a prior work that uses the same generation procedure §4.1; graph-clustering and other clustering comparisons §2. None has a card in this wiki.
- Compared against: the paper compares its seven methods with each other only.
- Superseded by: not stated.
Source and license
Adapted from “Clustering Algorithms: A Comparative Approach” by Mayra Z. Rodriguez, Cesar H. Comin, Dalcimar Casanova, Odemir M. Bruno, Diego R. Amancio, Francisco A. Rodrigues, Luciano da F. Costa (arXiv:1612.08388), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors.