Challenge - 5 Problems
KNN Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
How K affects KNN predictions
In K-Nearest Neighbors, what happens if you increase the value of K too much?
Attempts:
2 left
❓ Predict Output
intermediate2:00remaining
Output of KNN prediction with given neighbors
Given the following distances and labels of neighbors, what will the KNN predict for K=3?
neighbors = [(0.5, 'A'), (0.7, 'B'), (0.9, 'A'), (1.2, 'B')]
Attempts:
2 left
❓ Hyperparameter
advanced2:00remaining
Choosing the best K value
You have a dataset and want to choose the best K for KNN. Which method is the most reliable to find the best K?
Attempts:
2 left
❓ Metrics
advanced2:00remaining
Effect of K on bias and variance
How does increasing K in KNN affect bias and variance?
Attempts:
2 left
🔧 Debug
expert2:00remaining
Identifying error in KNN distance calculation
What error does the following code produce when calculating Euclidean distance between two points?
def euclidean_distance(p1, p2):
return sum((x - y) ** 2 for x, y in zip(p1)) ** 0.5
print(euclidean_distance([1, 2], [4, 6]))Attempts:
2 left