0
0
ML Pythonml~20 mins

Cluster evaluation metrics in ML Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Cluster Evaluation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Silhouette Score Interpretation
Which statement best describes what a Silhouette Score close to +1 indicates about a clustering result?
AClusters have many outliers and points are far from cluster centers
BClusters are overlapping heavily and points are assigned randomly
CClusters are well separated and points are appropriately assigned to their clusters
DClusters are too small and have very few points
Attempts:
2 left
💡 Hint
Think about what a high Silhouette Score means for the distance between points and their own cluster versus other clusters.
Predict Output
intermediate
2:00remaining
Output of Adjusted Rand Index Calculation
What is the output of the following Python code snippet using sklearn.metrics.adjusted_rand_score?
ML Python
from sklearn.metrics import adjusted_rand_score
labels_true = [0, 0, 1, 1, 2, 2]
labels_pred = [1, 1, 0, 0, 2, 2]
score = adjusted_rand_score(labels_true, labels_pred)
print(round(score, 2))
A1.0
B0.0
C-1.0
D0.5
Attempts:
2 left
💡 Hint
Adjusted Rand Index is symmetric and equals 1 when clusterings are identical up to label permutation.
Model Choice
advanced
2:00remaining
Choosing the Best Metric for Clustering with Unknown Labels
You have unlabeled data and want to evaluate your clustering algorithm's quality. Which metric is most appropriate?
AAdjusted Rand Index
BSilhouette Score
CNormalized Mutual Information
DAccuracy
Attempts:
2 left
💡 Hint
Consider which metrics require true labels and which do not.
Metrics
advanced
2:00remaining
Interpreting Davies-Bouldin Index Values
Which of the following statements about the Davies-Bouldin Index (DBI) is true?
ALower DBI values indicate better clustering with compact and well-separated clusters
BHigher DBI values indicate better clustering quality
CDBI values range from 0 to 1, where 1 is perfect clustering
DDBI is only valid for binary clustering problems
Attempts:
2 left
💡 Hint
Think about what a low versus high DBI means for cluster similarity and separation.
🔧 Debug
expert
2:00remaining
Identifying the Error in Cluster Evaluation Code
What error will the following code raise when executed?
ML Python
from sklearn.metrics import silhouette_score
X = [[1, 2], [2, 3], [10, 10], [11, 11]]
labels = [0, 0, 1]
score = silhouette_score(X, labels)
print(score)
ANo error, prints a float score
BTypeError: silhouette_score() missing required positional argument
CIndexError: list index out of range
DValueError: Number of labels does not match number of samples
Attempts:
2 left
💡 Hint
Check if the number of labels matches the number of data points.