Silhouette Score

noun

say it: “sil-oo-ET SKOR” /ˌsɪluˈɛt ˈskɔr/

A score from -1 to 1 that measures how clearly each example belongs to its own group rather than a neighboring one.

What is the silhouette score?

The silhouette score says how well examples sit in their own cluster rather than the next nearest one, from -1 to 1: near 1 means clear, well-separated clusters, near 0 means clusters that overlap. Unlike inertia, it doesn't always improve with more clusters, so it helps choose k. scikit-learn's is silhouette_score().

from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_score
visits = [[1, 30], [2, 28], [1, 32], [6, 5], [7, 6], [6, 4]]   # visits a week, dollars a visit
for k in (2, 3):
    labels = KMeans(n_clusters=k, random_state=0).fit_predict(visits)
    print(k, round(silhouette_score(visits, labels), 2))
# 2 0.91     two clear groups
# 3 0.57

In a sentence

  • “A silhouette score near 0 meant the groups overlapped.”
  • “The silhouette score was highest at k=2, so she kept two groups.”

Level: Freelancer · More AI Basics terms at this level

Updated