V-Measure Calculator (Homogeneity, Completeness & V-Measure)
Paste your ground-truth classes and predicted cluster IDs to get the homogeneity, completeness and V-measure of a clustering — with the full conditional-entropy working and contingency table. Runs in your browser, no signup, matched to scikit-learn.
How it works
V-measure is an external clustering-evaluation metric: it scores a predicted clustering against known class labels. Rosenberg and Hirschberg defined it in 2007 from two complementary criteria — homogeneity and completeness — each expressed through conditional entropy. Let C be the true classes, K the predicted clusters, N the number of points, and a(c,k) the count of points in class c and cluster k. All logarithms are natural; the base cancels in every ratio, exactly as scikit-learn does.
h = 1 − H(C|K)/H(C) · c = 1 − H(K|C)/H(K) · V_β = (1+β)·h·c / (β·h + c)
- Build the contingency table a(c,k). Its row sums are the class sizes n_c and its column sums are the cluster sizes n_k.
- Compute the class and cluster entropies with the 0·ln0 = 0 convention: H(C) = −Σ (n_c/N)·ln(n_c/N) and H(K) = −Σ (n_k/N)·ln(n_k/N).
- Compute the conditional entropies H(C|K) = −Σ (a/N)·ln(a/n_k) and H(K|C) = −Σ (a/N)·ln(a/n_c), summing only over the non-empty cells.
- Homogeneity h = 1 − H(C|K)/H(C) rewards clusters that each hold a single class; completeness c = 1 − H(K|C)/H(K) rewards keeping each class in one cluster. When H(C) = 0 (only one class present) homogeneity is set to 1 by convention, and likewise completeness when H(K) = 0.
- Combine them: V_β = (1+β)·h·c/(β·h + c). With β = 1 this is the harmonic mean 2hc/(h+c). β above 1 weights completeness; below 1 weights homogeneity.
As a built-in correctness check the tool also computes the mutual information straight from the contingency table, I(C;K) = Σ (a/N)·ln((a·N)/(n_c·n_k)), and reconciles it with both H(C) − H(C|K) and H(K) − H(K|C). Because homogeneity is I/H(C) and completeness is I/H(K), this is the identity scikit-learn relies on — so V-measure equals normalized mutual information under arithmetic-mean normalization. Two facts double as sanity signals: every score sits in [0, 1], and V-measure is symmetric in the two label columns.
Worked examples
Frequently asked questions
Sources & references
- Rosenberg & Hirschberg (2007), “V-Measure: A Conditional Entropy-Based External Cluster Evaluation Measure”, EMNLP-CoNLL — the defining paper
- scikit-learn — homogeneity_completeness_v_measure (reference implementation and edge-case rules)
- scikit-learn — Homogeneity, completeness and V-measure user guide
The formulas and conventions on this page were last cross-checked against Rosenberg & Hirschberg and scikit-learn on 2026-07-12. The worked examples reproduce to the displayed precision against sklearn.metrics.homogeneity_completeness_v_measure.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want to suggest an improvement?
Email me at [email protected] — most fixes ship within 24 hours.