X = load_iris().data
y = load_iris().target
for n_cluster in range(2, 11):
    kmeans = KMeans(n_clusters=n_cluster).fit(X)
label = kmeans.labels_
sil_coeff = silhouette_score(X, label, metric='euclidean')
print('For n_clusters={}, The Silhouette Coefficient is {}'.format(n_cluster,
    sil_coeff))
Scikit Learn — K-средние — локоть — критерий