Practice
1. What is the time complexity of updating the learning rate using PyTorch's
StepLR scheduler for each epoch?easy
Solution
Step 1: Analyze StepLR update mechanism
StepLR updates the learning rate by multiplying it with a constant factor, which is a constant time operation.Step 2: Determine time complexity
Since the update is a simple multiplication, the time complexity is O(1).Final Answer:
Option C -> Option CQuick Check:
StepLR update is a constant time operation. [OK]
Hint: StepLR update is a constant time operation. [OK]
Common Mistakes:
2. In the context of logistic regression, which approach is correct for handling a dataset with highly imbalanced classes?
medium
Solution
Step 1: Identify the problem with imbalanced classes
Imbalanced classes can lead to biased predictions towards the majority class.Step 2: Choose a method to address imbalance
SMOTE (Synthetic Minority Over-sampling Technique) is effective for balancing datasets.Final Answer:
Option B -> Option BQuick Check:
SMOTE balances classes effectively [OK]
Hint: SMOTE balances classes effectively [OK]
Common Mistakes:
3. How would you modify the Mini-Batch SGD with Momentum to handle sparse data more efficiently?
medium
Solution
Step 1: Identify the challenge with sparse data
Sparse data often leads to many zero gradients, making full updates inefficient.Step 2: Choose the appropriate modification
Lazy updates only update non-zero elements, reducing unnecessary computations and improving efficiency.Final Answer:
Option D -> Option DQuick Check:
Use lazy updates for sparse data efficiency [OK]
Hint: Use lazy updates for sparse data efficiency [OK]
Common Mistakes:
4. How would you adapt the ROC curve implementation to handle multi-class classification?
medium
Solution
Step 1: Understand multi-class ROC adaptation
One-vs-rest strategy is commonly used to compute ROC for each class separately.Step 2: Eliminate wrong options
Use the average of ROC curves for each class. is incorrect as averaging doesn't apply directly, Options C and D are mathematically incorrect.Final Answer:
Option A -> Option AQuick Check:
Use one-vs-rest for multi-class ROC [OK]
Hint: Use one-vs-rest for multi-class ROC [OK]
Common Mistakes:
5. How can you optimize the implementation of a learning rate scheduler to reduce computational overhead in a large-scale training setup?
hard
Solution
Step 1: Identify computational overhead sources
Frequent updates can increase overhead, especially in large-scale setups.Step 2: Optimize scheduler updates
Creating a custom scheduler that reduces the frequency of updates can minimize computational costs while maintaining performance.Final Answer:
Option D -> Option DQuick Check:
Custom schedulers can reduce update frequency. [OK]
Hint: Custom schedulers can reduce update frequency. [OK]
Common Mistakes:
