Practice
1. What is the time complexity of a single iteration of gradient descent for linear regression with n samples and d features?
easy
Solution
Step 1: Identify operations in a single iteration
Each iteration involves matrix multiplication and gradient computation.Step 2: Calculate complexity
Matrix multiplication and gradient computation both require O(nd) operations.Final Answer:
Option C -> Option CQuick Check:
Matrix operations scale with samples and features. [OK]
Hint: Matrix operations scale with samples and features. [OK]
Common Mistakes:
2. What is the time complexity of calculating the mean Average Precision (mAP) for a single image with N predicted bounding boxes and M ground truth boxes?
easy
Solution
Step 1: Understand the Process
For each predicted box, IoU is calculated with each ground truth box, leading to N * M comparisons.Step 2: Determine Complexity
Each comparison is constant time, so the overall complexity is O(N * M).Final Answer:
Option C -> Option CQuick Check:
IoU comparisons drive complexity [OK]
Hint: IoU comparisons drive complexity [OK]
Common Mistakes:
3. You implemented stratified K-Fold cross-validation but notice class imbalance in some folds. What is the most likely cause?
medium
Solution
Step 1: Identify stratification issue
Stratification ensures class distribution is preserved in each fold.Step 2: Eliminate wrong options
Incorrect number of splits and D relate to fold count, not class distribution. Data shuffling before splitting affects randomness, not stratification.Final Answer:
Option A -> Option AQuick Check:
Check stratification parameter for class balance. [OK]
Hint: Check stratification parameter for class balance. [OK]
Common Mistakes:
4. You implemented gradient checking but the numerical and analytical gradients differ significantly. What is the most likely cause?
medium
Solution
Step 1: Identify potential causes for gradient mismatch
Significant differences often indicate errors in the analytical gradient.Step 2: Eliminate other options
The step size for numerical gradient is too large. would cause small numerical errors, not significant differences. The learning rate is too high. and C are unrelated to gradient checking.Final Answer:
Option C -> Option CQuick Check:
Mismatch often means analytical error. [OK]
Hint: Mismatch often means analytical error. [OK]
Common Mistakes:
5. In a text classification task using Multinomial Naive Bayes, which preprocessing step is crucial for improving model performance?
medium
Solution
Step 1: Understand text preprocessing needs
In text classification, irrelevant words can add noise.Step 2: Evaluate preprocessing steps
Removing stop words (Removing stop words) reduces noise and improves performance. Options A and C are less relevant as MultinomialNB doesn't require normalized or scaled features. Applying PCA for dimensionality reduction is unnecessary as PCA isn't typically used for text data.Final Answer:
Option C -> Option CQuick Check:
Remove stop words to reduce noise in text data. [OK]
Hint: Remove stop words to reduce noise in text data. [OK]
Common Mistakes:
