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 snippet, what will be the output?
import numpy as np
business_goals = np.array(['increase sales', 'reduce churn', 'improve satisfaction'])
ml_problems = np.array(['classification', 'regression', 'clustering'])
result = np.char.add(business_goals, ml_problems)
print(result)easy
Solution
Step 1: Understand the operation
The np.char.add function concatenates corresponding elements of two arrays element-wise.Step 2: Eliminate wrong options
['increase sales', 'reduce churn', 'improve satisfaction'] and C are incorrect because they ignore the concatenation operation. Throws an error due to incompatible types is incorrect because np.char.add handles string arrays correctly.Final Answer:
Option A -> Option AQuick Check:
np.char.add concatenates strings element-wise. [OK]
Hint: np.char.add concatenates strings element-wise. [OK]
Common Mistakes:
3. A model performs well overall but poorly on a specific slice of data. What is the most likely cause?
medium
Solution
Step 1: Analyze the problem
Poor performance on a specific slice often indicates distribution mismatch.Step 2: Eliminate wrong options
The model is overfitting to the training data. is incorrect as overfitting would affect overall performance. The model has too many parameters. is unrelated to slice-specific issues. The learning rate is too high. affects convergence, not slice performance.Final Answer:
Option A -> Option AQuick Check:
Slice mismatch = distribution issue. [OK]
Hint: Slice mismatch = distribution issue. [OK]
Common Mistakes:
4. A model is showing unexpectedly high validation accuracy but low test accuracy. What is the most likely cause?
medium
Solution
Step 1: Diagnose the issue
High validation accuracy but low test accuracy suggests the validation set may not be representative.Step 2: Eliminate wrong options
The model is underfitting the training data. would affect both validation and test accuracy, The test set is too similar to the training set. would not cause low test accuracy, and The model has too many parameters. would affect both validation and test accuracy similarly.Final Answer:
Option D -> Option DQuick Check:
Small validation set = misleading accuracy [OK]
Hint: Small validation set = misleading accuracy [OK]
Common Mistakes:
5. A Lasso regression model is underperforming with high bias. What is the most likely cause?
medium
Solution
Step 1: Identify the effect of high alpha in Lasso.
High alpha increases regularization strength, leading to high bias.Step 2: Eliminate wrong options.
Large datasets do not cause overfitting. High complexity increases variance, not bias. Non-normalized features affect scale, not bias directly.Final Answer:
Option D -> Option DQuick Check:
High alpha = high bias in Lasso. [OK]
Hint: High alpha = high bias in Lasso. [OK]
Common Mistakes:
