Practice
1. What is the time complexity of computing a confusion matrix for a binary classification problem with n predictions?
easy
Solution
Step 1: Analyze the operation
Computing a confusion matrix involves iterating over predictions once.Step 2: Determine complexity
Each prediction is checked once, leading to O(n) complexity.Final Answer:
Option C -> Option CQuick Check:
Confusion matrix computation is linear in predictions. [OK]
Hint: Confusion matrix computation is linear in predictions. [OK]
Common Mistakes:
2. What is the time complexity of the K-Means clustering algorithm implemented from scratch using Lloyd's algorithm?
easy
Solution
Step 1: Analyze the algorithm
The time complexity is determined by the number of data points (n), clusters (k), dimensions (d), and iterations (i).Step 2: Eliminate wrong options
O(n^2) and C are incorrect as they don't account for k, d, and i. O(k^2) is incorrect because it doesn't consider n, d, and i.Final Answer:
Option A -> Option AQuick Check:
Consider n, k, d, and i for complexity. [OK]
Hint: Consider n, k, d, and i for complexity. [OK]
Common Mistakes:
3. What is the time complexity of a single update step in Mini-Batch SGD with Momentum for a model with
n parameters?easy
Solution
Step 1: Identify operations involved
Each update step involves computing the gradient and updating the velocity and parameters, all of which are linear operations with respect to the number of parameters.Step 2: Determine the complexity
Since each operation is linear, the overall complexity isO(n).Final Answer:
Option A -> Option AQuick Check:
Each parameter update is linear in complexity [OK]
Hint: Each parameter update is linear in complexity [OK]
Common Mistakes:
4. A decision tree implementation is producing only one node. What is the most likely cause?
medium
Solution
Step 1: Identify stopping criteria issue
Strict stopping criteria prevent further splits, causing a single node.Step 2: Eliminate wrong options
Small dataset (A) or low threshold (C) would still allow splits; high depth (D) is irrelevant here.Final Answer:
Option A -> Option AQuick Check:
Single node? Check stopping criteria [OK]
Hint: Single node? Check stopping criteria [OK]
Common Mistakes:
5. You implemented linear regression using gradient descent, but the model is not converging. What is the most likely cause?
medium
Solution
Step 1: Identify symptoms of non-convergence
Non-convergence often results from oscillations due to a high learning rate.Step 2: Eliminate other options
Low learning rate causes slow convergence, not non-convergence. Dataset size and feature count affect overfitting, not convergence.Final Answer:
Option B -> Option BQuick Check:
High learning rate causes oscillations. [OK]
Hint: High learning rate causes oscillations. [OK]
Common Mistakes:
