What is the purpose of choosing the right K in clustering?
Choosing the right K helps find the best number of groups (clusters) in data so that each group is meaningful and different from others.
Click to reveal answer
beginner
What does the elbow method show in a graph?
The elbow method plots the total distance of points to their cluster centers for different K values. The 'elbow' point where the decrease slows down suggests a good K.
Click to reveal answer
intermediate
How is the silhouette score used to choose K?
The silhouette score measures how well each point fits in its cluster compared to others. Higher average scores mean better clustering, helping pick the best K.
Click to reveal answer
intermediate
What does a low silhouette score indicate about clusters?
A low silhouette score means clusters overlap or points are not well matched to their cluster, suggesting a poor choice of K or clustering.
Click to reveal answer
advanced
Why might the elbow method sometimes be unclear?
Sometimes the graph does not have a clear 'elbow' point, making it hard to decide K. In such cases, other methods like silhouette score help.
Click to reveal answer
What does the 'elbow' in the elbow method graph represent?
AThe highest number of clusters tested
BThe point where adding more clusters doesn't reduce distance much
CThe lowest silhouette score
DThe average distance between clusters
✗ Incorrect
The elbow is where the decrease in total distance slows, showing a good balance between cluster number and compactness.
Which score indicates better clustering quality?
AHigher total within-cluster distance
BLower silhouette score
CHigher silhouette score
DLower number of clusters
✗ Incorrect
Higher silhouette scores mean points fit well in their clusters and clusters are well separated.
If silhouette scores are low for all K values, what does it suggest?
AData may not form clear clusters
BElbow method is better here
CK is too high
DClusters are very distinct
✗ Incorrect
Low silhouette scores mean points don't fit well in any cluster, so data might not have clear groups.
What is a common use of the elbow method?
ATo select the number of clusters K
BTo measure model accuracy
CTo find the best learning rate
DTo reduce data dimensions
✗ Incorrect
The elbow method helps decide the number of clusters K in clustering tasks.
Which method can help when the elbow method is unclear?
APCA
BCross-validation
CGradient descent
DSilhouette score
✗ Incorrect
Silhouette score provides a numeric measure of cluster quality and can guide K choice when elbow is unclear.
Explain how the elbow method helps in choosing the number of clusters K.
You got /3 concepts.
Describe what the silhouette score measures and how it guides choosing K.
You got /4 concepts.
Practice
(1/5)
1. What is the main goal when choosing the number of clusters K in clustering algorithms?
easy
A. To find the number of groups that best represent the data
B. To maximize the number of clusters regardless of data
C. To minimize the number of clusters to one
D. To randomly select a number without analysis
Solution
Step 1: Understand the purpose of clustering
Clustering groups similar data points together to find patterns.
Step 2: Identify the role of choosing K
Choosing K means deciding how many groups best represent the data structure.
Final Answer:
To find the number of groups that best represent the data -> Option A
Quick Check:
Choosing K = best data groups [OK]
Hint: Choose K to best represent data groups, not randomly [OK]
Common Mistakes:
Picking K without checking data patterns
Choosing too many clusters blindly
Ignoring the meaning of clusters
2. Which of the following Python code snippets correctly computes the silhouette score for clustering results stored in labels with data X?
easy
A. from sklearn.metrics import silhouette_score
score = silhouette_score(labels, X)
B. from sklearn.cluster import silhouette_score
score = silhouette_score(labels, X)
C. from sklearn.metrics import silhouette_score
score = silhouette_score(X, labels)
D. from sklearn.cluster import silhouette_score
score = silhouette_score(X, labels)
Solution
Step 1: Check the correct import
The silhouette_score function is in sklearn.metrics, not sklearn.cluster.
Step 2: Verify function parameters order
The function takes data first (X), then cluster labels (labels).
Final Answer:
from sklearn.metrics import silhouette_score\nscore = silhouette_score(X, labels) -> Option C
Quick Check:
Correct import and parameter order = from sklearn.metrics import silhouette_score
score = silhouette_score(X, labels) [OK]
Hint: Import from metrics and pass data first, labels second [OK]
Common Mistakes:
Importing silhouette_score from wrong module
Swapping data and labels in function call
Using cluster module instead of metrics
3. Given the following code, what will be the printed silhouette score?
from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_score
import numpy as np
X = np.array([[1, 2], [1, 4], [1, 0], [10, 2], [10, 4], [10, 0]])
kmeans = KMeans(n_clusters=2, random_state=42).fit(X)
labels = kmeans.labels_
score = silhouette_score(X, labels)
print(round(score, 2))
medium
A. 0.50
B. 0.74
C. 0.30
D. 1.00
Solution
Step 1: Understand the data and clustering
The data has two clear groups around [1, x] and [10, x], so KMeans with 2 clusters fits well.
Step 2: Calculate silhouette score
Silhouette score measures cluster quality; for well-separated clusters, it is close to 1. Running the code gives approximately 0.74.
Final Answer:
0.74 -> Option B
Quick Check:
Well-separated clusters give silhouette ~0.74 [OK]
Hint: Well-separated clusters usually have silhouette > 0.7 [OK]
Common Mistakes:
Expecting silhouette score to be 1.0 always
Confusing silhouette with inertia
Ignoring cluster separation in score
4. You run the elbow method but the inertia keeps decreasing smoothly without a clear elbow point. What is the best way to fix this issue?
medium
A. Try silhouette score to find the best K instead
B. Increase the number of clusters to the maximum possible
C. Ignore the elbow method and pick K=1
D. Use random K values without checking metrics
Solution
Step 1: Identify the problem with elbow method
If inertia decreases smoothly, no clear elbow means it's hard to pick K by this method.
Step 2: Use alternative metric
Silhouette score measures cluster quality differently and can help find the best K when elbow is unclear.
Final Answer:
Try silhouette score to find the best K instead -> Option A
Quick Check:
Use silhouette when elbow is unclear [OK]
Hint: Switch to silhouette score if elbow is unclear [OK]
Common Mistakes:
Forcing a large K without reason
Ignoring metrics and guessing K
Picking K=1 without analysis
5. You have a dataset with 5 natural clusters but the elbow method suggests K=3 and silhouette score suggests K=5. Which K should you choose and why?
hard
A. Choose K=3 because elbow method always gives the best K
B. Choose K=10 to overfit the data
C. Choose K=1 to simplify the model
D. Choose K=5 because silhouette score better reflects cluster separation
Solution
Step 1: Compare elbow and silhouette methods
Elbow method focuses on inertia reduction, which can miss subtle clusters; silhouette measures cluster quality and separation.
Step 2: Match method to data nature
Since the dataset has 5 natural clusters, silhouette score's suggestion aligns better with true structure.
Final Answer:
Choose K=5 because silhouette score better reflects cluster separation -> Option D
Quick Check:
Silhouette score > elbow for true cluster count [OK]
Hint: Trust silhouette score for natural cluster counts [OK]
Common Mistakes:
Blindly trusting elbow method over silhouette
Choosing too few clusters ignoring data
Overfitting by choosing too many clusters
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.