Practice
1. Given the following Python code, what is the output when evaluating the calibration of a model using Brier Score?
from sklearn.metrics import brier_score_loss
true_labels = [0, 1, 1, 0]
predicted_probs = [0.1, 0.9, 0.8, 0.4]
score = brier_score_loss(true_labels, predicted_probs)
print(score)easy
Solution
Step 1: Understand Brier Score calculation.
Brier Score is the mean squared difference between predicted probabilities and actual outcomes.Step 2: Calculate the score.
For each pair: (0.1-0)^2, (0.9-1)^2, (0.8-1)^2, (0.4-0)^2. Mean = (0.01 + 0.01 + 0.04 + 0.16) / 4 = 0.055.Final Answer:
Option D -> Option DQuick Check:
Brier Score = mean squared error of probabilities. [OK]
Hint: Brier Score = mean squared error of probabilities. [OK]
Common Mistakes:
2. In the context of distributional shift, which type of drift occurs when the statistical properties of the input features change over time?
easy
Solution
Step 1: Identify the type of drift.
Covariate drift refers to changes in the distribution of input features.Step 2: Eliminate wrong options.
Label drift involves changes in the distribution of the output labels. Concept drift involves changes in the relationship between inputs and outputs. Feature drift is not a standard term.Final Answer:
Option C -> Option CQuick Check:
Covariate drift = input feature change [OK]
Hint: Covariate drift = input feature change [OK]
Common Mistakes:
3. In a dataset with highly imbalanced classes, which sampling strategy is most appropriate to ensure each class is represented proportionally in the sample?
easy
Solution
Step 1: Identify the need for proportional representation.
In imbalanced datasets, it's crucial to maintain class proportions to avoid bias.Step 2: Eliminate inappropriate strategies.
Random Sampling (A) doesn't guarantee class proportions. Reservoir Sampling (C) is for streaming data, not class balance. Weighted Sampling (D) adjusts for importance, not proportions.Final Answer:
Option A -> Option AQuick Check:
Stratified = Proportional representation [OK]
Hint: Stratified = Proportional representation [OK]
Common Mistakes:
4. A model registered in MLflow Registry is not showing the expected performance in production. What is the most likely cause?
medium
Solution
Step 1: Analyze potential causes of performance issues
Data discrepancies are a common cause of unexpected model performance.Step 2: Eliminate less likely causes
Incorrect dataset usage is more likely than versioning or packaging issues.Final Answer:
Option D -> Option DQuick Check:
Check dataset consistency [OK]
Hint: Check dataset consistency [OK]
Common Mistakes:
5. When should you prefer using LightGBM over XGBoost for a gradient boosting task?
medium
Solution
Step 1: Identify LightGBM's strengths
LightGBM is optimized for speed and performance on large datasets with high dimensionality.Step 2: Eliminate wrong options
When you need better accuracy on small datasets. is incorrect because XGBoost often performs better on small datasets. When interpretability of the model is the primary concern. is incorrect because neither LightGBM nor XGBoost is particularly interpretable. When you require a model that handles categorical features natively. is incorrect because both can handle categorical features, but LightGBM is faster on large datasets.Final Answer:
Option A -> Option AQuick Check:
LightGBM = Large, high-dimensional data [OK]
Hint: LightGBM = Large, high-dimensional data [OK]
Common Mistakes:
