Practice
1. What is the time complexity of the forward pass of batch normalization for a dataset with n samples and d features?
easy
Solution
Step 1: Analyze the operations
Batch normalization involves computing mean and variance, both O(n * d) operations.Step 2: Consider the normalization step
Normalizing each feature is also O(n * d).Final Answer:
Option D -> Option DQuick Check:
Batch norm: O(n * d) for mean/variance [OK]
Hint: Batch norm: O(n * d) for mean/variance [OK]
Common Mistakes:
2. What is the time complexity of performing a train-test split with stratification on a dataset with n samples?
easy
Solution
Step 1: Analyze the operation
Train-test split with stratification involves iterating over the dataset once to ensure class distribution.Step 2: Determine complexity
Since each element is processed once, the complexity is O(n).Final Answer:
Option A -> Option AQuick Check:
Stratified split processes each sample once. [OK]
Hint: Stratified split processes each sample once. [OK]
Common Mistakes:
3. You implemented a normalization function for image data, but the model's performance dropped. What is the most likely cause?
medium
Solution
Step 1: Identify normalization issues
Incorrect mean and std values can skew the data distribution.Step 2: Eliminate other options
Normalization was applied after data augmentation. is valid; Normalization was applied only to the training set. would cause a mismatch; Normalization was applied using the global mean and std. is standard practice.Final Answer:
Option C -> Option CQuick Check:
Check mean/std values for normalization. [OK]
Hint: Check mean/std values for normalization. [OK]
Common Mistakes:
4. In the implementation of Adam optimizer, the model is not converging. Which line of code is most likely causing the issue?
medium
Solution
Step 1: Identify the potential issue
The lineparameter -= learning_rate * m_hat / (np.sqrt(v_hat) + epsilon)is crucial for parameter updates. Ifepsilonis not properly set, it can cause division by zero or very small updates.Step 2: Eliminate other options
Options A, B, and C are standard parts of the Adam algorithm and unlikely to cause convergence issues unless there's a typo or logical error.Final Answer:
Option A -> Option AQuick Check:
Check epsilon in Adam's update step [OK]
Hint: Check epsilon in Adam's update step [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:
