← All notes

Statistical note

Clustering metrics: silhouette, ARI, and mutual information

Internal versus reference-based cluster evaluation, geometry assumptions, chance correction, and phenotype discovery.

10 min read

For sample ii, let a(i)a(i) be its mean distance to its own cluster and b(i)b(i) the smallest mean distance to another cluster. Its silhouette is

s(i)=b(i)a(i)max(a(i),b(i)),s(i)=\frac{b(i)-a(i)}{\max(a(i),b(i))},

which lies between 1-1 and 11. It favors compact, separated clusters under the chosen distance.

Internal separation and external agreement of clusters

from sklearn.metrics import (
    silhouette_score, adjusted_rand_score,
    normalized_mutual_info_score, v_measure_score,
)

X = [[0, 0], [0, 1], [5, 5], [5, 6], [9, 1], [9, 2]]
clusters = [0, 0, 1, 1, 2, 2]
reference = [1, 1, 0, 0, 2, 2]
print(silhouette_score(X, clusters))
print(adjusted_rand_score(reference, clusters))
print(normalized_mutual_info_score(reference, clusters))
print(v_measure_score(reference, clusters))

Case study: cell phenotypes

Silhouette uses feature-space geometry and needs no labels. Adjusted Rand index compares pairs of assignments against reference labels and corrects for chance. Mutual-information metrics quantify shared information but differ in normalization.

High internal separation does not prove biological reality. Check stability across resampling, batches, feature choices, and donors, then connect clusters to independent measurements.

Functions: sklearn.metrics.silhouette_score, adjusted_rand_score, normalized_mutual_info_score, homogeneity_completeness_v_measure, and davies_bouldin_score.