Practice
1. In which scenario is supervised learning most appropriate?
easy
Solution
Step 1: Identify the scenario.
Supervised learning is used when labeled data is available and the goal is to predict outcomes.Step 2: Eliminate wrong options.
When you want to cluster similar data points without labels. describes unsupervised learning (clustering), When you need to explore an environment to maximize rewards. describes reinforcement learning (exploration and rewards), and When you want to reduce dimensionality of data without labels. describes unsupervised learning (dimensionality reduction).Final Answer:
Option B -> Option BQuick Check:
Labeled data -> Supervised learning [OK]
Hint: Labeled data -> Supervised learning [OK]
Common Mistakes:
2. Given the following Python code snippet for a simplified self-attention mechanism, what is the shape of the output?
import torch
Q = torch.rand(2, 3, 4)
K = torch.rand(2, 4, 4)
V = torch.rand(2, 4, 5)
output = torch.matmul(torch.matmul(Q, K.transpose(-2, -1)), V)easy
Solution
Step 1: Analyze matrix multiplications
The first multiplicationtorch.matmul(Q, K.transpose(-2, -1))results in a shape of (2, 3, 4). The second multiplication with V results in (2, 3, 5).Step 2: Eliminate wrong options
(2, 4, 5) is incorrect because it assumes incorrect dimensions for Q. (2, 3, 4) is incorrect because it doesn't account for the final multiplication with V. (2, 5, 5) is incorrect because it assumes incorrect dimensions for the final output.Final Answer:
Option D -> Option DQuick Check:
Check matrix dimensions after each multiplication. [OK]
Hint: Check matrix dimensions after each multiplication. [OK]
Common Mistakes:
3. A model trained with K-Fold cross-validation is underperforming on unseen data. What is a likely cause?
medium
Solution
Step 1: Consider data leakage as a common issue.
Data leakage can occur if the same data points appear in both training and validation sets.Step 2: Eliminate wrong options.
Too many folds (A) typically doesn't cause overfitting, too few folds (C) would not cause underperformance on unseen data, model complexity (D) is unrelated to cross-validation setup.Final Answer:
Option B -> Option BQuick Check:
Check for data leakage in CV. [OK]
Hint: Check for data leakage in CV. [OK]
Common Mistakes:
4. A model deployed via a CI/CD pipeline is showing unexpected performance degradation. What is the most likely cause?
medium
Solution
Step 1: Identify potential causes of performance degradation.
Environment mismatch can lead to unexpected behavior due to differences in dependencies or configurations.Step 2: Eliminate less likely causes.
Not retraining (A) or skipping testing (B) would likely be caught earlier. Hyperparameter tuning (D) affects initial performance, not sudden degradation.Final Answer:
Option A -> Option AQuick Check:
Check environment consistency. [OK]
Hint: Check environment consistency. [OK]
Common Mistakes:
5. A model trained on a specific dataset performs poorly on new data. What is a likely cause related to the No Free Lunch Theorem?
medium
Solution
Step 1: Consider the No Free Lunch Theorem
The theorem implies that model performance is dataset-specific.Step 2: Eliminate wrong options
The model is too simple for the new data. is incorrect because simplicity isn't the main issue. The model was overfitted to the training dataset. is incorrect because overfitting affects generalization, but the core issue is distribution change. The model's hyperparameters were not optimized. is incorrect because hyperparameter tuning doesn't address distribution differences.Final Answer:
Option A -> Option AQuick Check:
Performance varies with data distribution. [OK]
Hint: Performance varies with data distribution. [OK]
Common Mistakes:
