How to calculate the Silhouette Score for the whole cluster

977 views Asked by At

we can easily extract the silhouette score for each sample. If our data looks something like this: I want to be able to calculate the silhouette score for the whole cluster solution

import pandas as pd
import numpy as np


X = np.array([0.85142858,0.85566274,0.85364912,0.81536489,0.84929932,0.85042336,0.84899714,
         0.82019115, 0.86112067,0.8312496 ])
X=X.reshape(-1, 1)

num_clusters = 3
kmeans_model = KMedoids(n_clusters=num_clusters, random_state=1).fit(X)
cluster_labels = kmeans_model.labels_
0

There are 0 answers