sihouette score returns inconsistent number of sample

You’ve got a problem here:

print(silhouette_score(link, clusters))

Change it and you’re fine to go:

print(silhouette_score(X, clusters))

Please see docs for silhouette_score:

X: array [n_samples_a, n_samples_a] if metric == “precomputed”, or, [n_samples_a, n_features] otherwise.
Array of pairwise distances between samples, or a feature array.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top