Implement a function to compute the Silhouette Score for clustering. The Silhouette Score measures how well each point fits within its cluster compared to other clusters.
For each sample i:
The silhouette for point i is:
s(i)=max(a(i),b(i))b(i)−a(i)The final score is the mean of all s(i).
Input: X=[[0,0],[0,1],[1,0],[5,5],[5,6],[6,5]], labels=[0,0,0,1,1,1]
Output: ≈ 0.79
Use broadcasting to compute all-pairs Euclidean distances efficiently.
Use boolean masking to efficiently compute intra-cluster and inter-cluster means.
Sign in to take notes on this problem
Accepts: array
Accepts: array
Implement a function to compute the Silhouette Score for clustering. The Silhouette Score measures how well each point fits within its cluster compared to other clusters.
For each sample i:
The silhouette for point i is:
s(i)=max(a(i),b(i))b(i)−a(i)The final score is the mean of all s(i).
Input: X=[[0,0],[0,1],[1,0],[5,5],[5,6],[6,5]], labels=[0,0,0,1,1,1]
Output: ≈ 0.79
Use broadcasting to compute all-pairs Euclidean distances efficiently.
Use boolean masking to efficiently compute intra-cluster and inter-cluster means.
Sign in to take notes on this problem
Accepts: array
Accepts: array