How is the silhouette coefficient for an individual data point calculated?

Last updated 11 November 2026

  • Compute a(i), the mean distance from point i to the rest of its own cluster, and b(i), the smallest mean distance from i to any other cluster.

  • s(i) = (b − a) / max(a, b), which always lies in [−1, 1]. For example, a = 2 and b = 8 gives 0.75.

  • s(i) = 0 for a singleton cluster. The cost is O(n²). silhouette_samples gives per-point values and silhouette_score gives their mean.

  • https://fahimfaisal.info/ml_and_llm_learning/23_clustering_evaluation/INTERVIEW_GRILL.html
All Clustering interview questions