Practice
1. In the context of handling class imbalance, which technique is specifically designed to adjust the loss function to focus more on hard-to-classify examples?
easy
Solution
Step 1: Identify the technique that modifies the loss function.
Focal Loss is designed to focus more on hard-to-classify examples by adjusting the loss function.Step 2: Eliminate wrong options.
Oversampling and undersampling adjust the dataset, not the loss function. Cost-sensitive learning modifies the cost, not the focus on hard examples.Final Answer:
Option D -> Option DQuick Check:
Focal Loss focuses on hard examples. [OK]
Hint: Focal Loss focuses on hard examples. [OK]
Common Mistakes:
2. Given the following Python code, what will be the output if the model is overfitting?
from sklearn.metrics import accuracy_score
train_preds = model.predict(X_train)
val_preds = model.predict(X_val)
train_acc = accuracy_score(y_train, train_preds)
val_acc = accuracy_score(y_val, val_preds)
print(f'Train Accuracy: {train_acc}, Validation Accuracy: {val_acc}')easy
Solution
Step 1: Understand overfitting output
Overfitting results in high training accuracy but low validation accuracy.Step 2: Eliminate wrong options
Train Accuracy: 0.95, Validation Accuracy: 0.95 suggests good generalization, Train Accuracy: 0.60, Validation Accuracy: 0.60 suggests underfitting, and Train Accuracy: 0.60, Validation Accuracy: 0.95 is unrealistic for overfitting.Final Answer:
Option A -> Option AQuick Check:
High train, low validation = overfitting [OK]
Hint: High train, low validation = overfitting [OK]
Common Mistakes:
3. A model using Batch Normalization is showing unstable training behavior with fluctuating loss. What is the most likely cause?
medium
Solution
Step 1: Identify the role of batch size in Batch Normalization.
Batch Normalization relies on accurate batch statistics, which can be unreliable with small batch sizes.Step 2: Eliminate other causes.
The learning rate is too high, causing instability. is a common issue but not specific to Batch Norm. The model architecture is too deep, causing vanishing gradients. is unrelated to normalization. The dataset is imbalanced, affecting the normalization process. affects model performance but not directly related to Batch Norm instability.Final Answer:
Option A -> Option AQuick Check:
Small batch size causes unstable Batch Norm. [OK]
Hint: Small batch size causes unstable Batch Norm. [OK]
Common Mistakes:
4. A model performs well offline but poorly online. What is the most likely cause of this discrepancy?
medium
Solution
Step 1: Analyze the difference between offline and online environments.
Offline evaluation uses historical data, while online evaluation deals with live data, which may have a different distribution.Step 2: Eliminate other potential causes.
The model is overfitting to the training data. is incorrect because overfitting would likely affect both offline and online performance. The model's hyperparameters are not optimized. is incorrect because hyperparameter optimization affects both environments. The offline evaluation used an incorrect metric. is incorrect because using an incorrect metric would not cause a discrepancy between environments.Final Answer:
Option A -> Option AQuick Check:
Different data distribution online. [OK]
Hint: Different data distribution online. [OK]
Common Mistakes:
5. You are tasked with designing a monitoring system for an ML model in production. Which approach ensures robust detection of both data drift and performance decay?
hard
Solution
Step 1: Identify comprehensive monitoring strategies
Combining statistical tests with performance metrics covers both drift and decay.Step 2: Eliminate wrong options
Implement a feedback loop using user satisfaction surveys. is subjective and indirect. Rely solely on periodic model retraining. is reactive, not proactive. Monitor only the model's prediction confidence scores. is too narrow in scope.Final Answer:
Option B -> Option BQuick Check:
Combine stats and metrics for full coverage [OK]
Hint: Combine stats and metrics for full coverage [OK]
Common Mistakes:
