Course contentsShow
← Machine Learning and Deep Learning
Lesson 342 of 3,5388. Unsupervised Learning: ClusteringFree lesson

Silhouette Score

Measuring cluster quality with silhouette scores to validate clustering and compare different K values.

Silhouette Score

What you'll learn: How to measure the quality of your clusters using silhouette scores to validate your clustering and compare different K values.

What Is a Silhouette Score?

After running K-Means, you need to know: Are these clusters actually good? The silhouette score answers this by measuring how well each point fits within its assigned cluster compared to other clusters.

Think of it like evaluating friend groups at a party. A person has a high silhouette score if they're close to their own group and far from other groups. If someone is standing awkwardly between two groups, their score is low.

How It Works

For each data point, the silhouette score calculates:

  1. a: Average distance to other points in the same cluster (cohesion)
  2. b: Average distance to points in the nearest other cluster (separation)

The silhouette score for that point is: (b - a) / max(a, b)

  • Score near +1: Point is well-matched to its cluster and far from others (great!)
  • Score near 0: Point is on the border between clusters (ambiguous)
  • Score near -1: Point is probably in the wrong cluster (bad!)

Using Silhouette Scores

The overall silhouette score is the average across all points, ranging from -1 to +1. Higher is better.

This helps you:

  • Validate that K-Means produced meaningful clusters
  • Compare different K values beyond just the elbow method
  • Identify which K gives the most well-separated, cohesive clusters

Key Takeaway: The silhouette score quantifies cluster quality by measuring how similar points are to their own cluster versus neighboring clusters, with scores closer to +1 indicating better-defined clusters.