Complete the code to import the function that calculates the silhouette score.
from sklearn.metrics import [1] score = [1](X, labels)
The silhouette_score function measures how well samples are clustered.
Complete the code to calculate the Davies-Bouldin index for clustering evaluation.
from sklearn.metrics import davies_bouldin_score score = davies_bouldin_score(X, [1])
The Davies-Bouldin index requires the cluster labels to evaluate clustering quality.
Fix the error in the code to compute the adjusted Rand index correctly.
from sklearn.metrics import adjusted_rand_score score = adjusted_rand_score([1], true_labels)
The adjusted Rand index compares two cluster labelings: predicted and true labels.
Fill both blanks to create a dictionary comprehension that maps each cluster label to its count.
cluster_counts = {label: [1] for label in set(labels) if [2]The comprehension counts how many times each label appears. We include labels that are zero or positive.
Fill all three blanks to create a dictionary comprehension that maps each cluster label to the average silhouette score of its points.
silhouette_avg = {label: sum(scores[i] for i, l in enumerate(labels) if l == [1]) / [2] for label in set(labels) if [3]This comprehension calculates the average silhouette score per cluster label, including only labels zero or above.