Practice
1. What is the time complexity of computing the softmax function for an input array of size n?
easy
Solution
Step 1: Analyze operations
Softmax involves computing exponentials and a sum, both linear in n.Step 2: Determine complexity
Each operation is O(n), so overall complexity is O(n).Final Answer:
Option D -> Option DQuick Check:
Softmax is linear in input size [OK]
Hint: Softmax is linear in input size [OK]
Common Mistakes:
2. You implemented early stopping in your training loop, but the model still overfits. What is the most likely reason?
medium
Solution
Step 1: Analyze early stopping behavior
Early stopping relies on validation performance to halt training.Step 2: Identify the root cause of overfitting
If the validation set is too small, it may not accurately reflect generalization, leading to overfitting despite early stopping.Final Answer:
Option A -> Option AQuick Check:
Small validation set can mislead early stopping. [OK]
Hint: Small validation set can mislead early stopping. [OK]
Common Mistakes:
3. Your mAP implementation is returning unusually high values. What is the most likely cause?
medium
Solution
Step 1: Identify the Symptom
High mAP values suggest too many matches are considered correct.Step 2: Analyze Each Option
Incorrect IoU threshold for positive matches: A low IoU threshold can cause false positives to be counted as true positives, inflating mAP. Using precision instead of recall in calculations: Would affect recall, not mAP directly. Not normalizing the precision values: Would affect the scale, not the value. Including false negatives in the precision calculation: Would lower precision, not increase it.Final Answer:
Option B -> Option BQuick Check:
Check IoU threshold for false positives [OK]
Hint: Check IoU threshold for false positives [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 a naive 2D convolution implementation for large images and kernels?
hard
Solution
Step 1: Identify optimization techniques
Using FFT can significantly reduce the computational complexity of convolution from O(N^2 * K^2) to O(N^2 log N) for large images and kernels.Step 2: Eliminate wrong options
Use a larger stride to reduce computation. reduces output size, not computation. Increase the kernel size to cover more area. increases computation. Use a smaller kernel to decrease computation. limits kernel effectiveness.Final Answer:
Option C -> Option CQuick Check:
FFT reduces convolution complexity. [OK]
Hint: FFT reduces convolution complexity. [OK]
Common Mistakes:
