Hartigan's Rule for the Number of K-Means Clusters
Hartigan's rule decides how many k-means clusters to keep by asking whether adding one more cluster reduces the within-cluster sum of squares by more than chance would. It computes H(k) = (W_k / W_(k+1) - 1)(n - k - 1) for each k and keeps adding clusters while H(k) is larger than 10.
하티건 규칙은 군집을 하나 더 늘렸을 때 군집 내 제곱합이 우연보다 크게 줄어드는지를 보고 k-평균 군집 수를 정합니다. 각 k에 대해 H(k) = (W_k / W_(k+1) - 1)(n - k - 1)을 계산하고 H(k)가 10보다 큰 동안 군집을 계속 늘립니다.
How many k-means clusters does my data support before an extra cluster stops paying for itself?
군집을 하나 더 늘려도 이득이 없어지기 전까지 자료가 뒷받침하는 k-평균 군집 수는 몇 개입니까?
The method reports the within-cluster sum of squares and H(k) for every k up to the chosen maximum and selects the smallest k whose H(k) falls to the threshold or below. If H(k) stays above the threshold, it says that more clusters than tried are suggested.
When to use Hartigan's Rule for the Number of K-Means Clusters
- You plan a k-means segmentation and need a simple, documented rule for the number of clusters.
- You want a criterion that compares consecutive solutions rather than a visual elbow.
When to use something else
- Clusters are elongated, nested or of very different density: use DBSCAN Density Based Clustering
- You want several criteria side by side: use Optimal Number of Clusters (Elbow, Silhouette, Gap)
- You need a resampling-based answer about stability: use Prediction Strength for the Number of Clusters
Assumptions and requirements
- Clusters are compact and roughly spherical, as k-means assumes
- Variables are on comparable scales (standardised by default)
- K-means reaches a near-optimal solution for each k (several random starts)
What the analysis reports
- Within-cluster sum of squares W_k for each k
- Hartigan's H(k) and whether a cluster should be added
- Selected number of clusters and cluster sizes
How to report it
Hartigan's rule applied to k-means solutions for k = 1 to [value] selected k = [value] clusters (H([value]) = [value] > 10, H([value]) = [value] <= 10).
Related methods
- K-Means Clustering
- Optimal Number of Clusters (Elbow, Silhouette, Gap)
- Prediction Strength for the Number of Clusters
- Clest Resampling Estimate of the Number of Clusters
How this method is validated
이 방법의 검증 근거
- Independent computation. 1 reference test compares the results with direct computations (formulas, enumeration or simulation) at a stated tolerance of 1e-8.
독립 계산. 직접 계산(식·열거·모의실험) 대조 참조 시험 1건 통과(허용오차 1e-8).
Tolerances are relative differences (absolute differences for values near zero). R comparisons and reference tests are re-run before each release of the analysis engine.
허용오차는 상대 차이입니다(0 근처 값은 절대 차이). R 대조와 참조 시험은 분석 엔진을 배포할 때마다 다시 돌립니다.
Run Hartigan's Rule for the Number of K-Means Clusters on Quorant
- Data you need
- a table (CSV or Excel) with predictor (feature) columns
- Price
- 400 credits for one analysis up to 10,000 rows (complexity level 3); larger or wider data costs more. Optional methodologist review: 1800 credits.
- Checking
- Compared with independent computations
- Before you pay
- A free pre-analysis diagnosis checks your data and gives an exact quote; nothing is deducted until you approve it.