Challenge - 5 Problems
Evaluation Metrics Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Calculate RMSE for given predictions and true values
Given the true values and predicted values below, what is the RMSE (Root Mean Squared Error)?
ML Python
import numpy as np true_values = np.array([3, -0.5, 2, 7]) predictions = np.array([2.5, 0.0, 2, 8]) rmse = np.sqrt(np.mean((true_values - predictions) ** 2)) print(round(rmse, 3))
Attempts:
2 left
💡 Hint
RMSE is the square root of the average of squared differences between true and predicted values.
✗ Incorrect
RMSE measures how far predictions are from true values on average. Here, differences squared are [0.25, 0.25, 0, 1], average is 0.375, square root is about 0.612.
🧠 Conceptual
intermediate1:30remaining
Understanding Precision@k in recommendation systems
In a recommendation system, what does precision@3 measure?
Attempts:
2 left
💡 Hint
Precision@k focuses on the top k items recommended and how many are relevant.
✗ Incorrect
Precision@k counts how many of the top k recommended items are actually relevant, divided by k. It shows accuracy of top recommendations.
❓ Metrics
advanced1:30remaining
Choosing the right metric for regression error
Which metric is more sensitive to large errors in predictions?
Attempts:
2 left
💡 Hint
Think about how squaring errors affects large mistakes.
✗ Incorrect
RMSE squares the errors before averaging, so large errors have more impact than in MAE which uses absolute values.
🔧 Debug
advanced2:00remaining
Identify the error in precision@k calculation code
What error does the following code produce when calculating precision@k?
```python
relevant_items = {1, 3, 5, 7}
recommended_items = [2, 3, 4, 5]
k = 3
precision_at_k = len(set(recommended_items[:k]) & relevant_items) / len(recommended_items)
print(round(precision_at_k, 2))
```
Attempts:
2 left
💡 Hint
Precision@k divides by k, not total recommended items length.
✗ Incorrect
The denominator should be k (number of top items considered), but code divides by total recommended items length, giving wrong precision.
❓ Model Choice
expert2:30remaining
Selecting evaluation metric for imbalanced classification with ranking
You have a highly imbalanced dataset and want to evaluate a model that ranks positive samples higher than negatives. Which metric is best suited?
Attempts:
2 left
💡 Hint
Think about metrics that focus on top-ranked relevant items in imbalanced data.
✗ Incorrect
Precision@k measures how many of the top k ranked items are relevant, which is useful in imbalanced data where overall accuracy can be misleading.