Practice
1. In the context of backpropagation, which of the following best describes the role of the chain rule?
easy
Solution
Step 1: Understand the chain rule in backpropagation
The chain rule is used to compute the gradient of the loss function with respect to each weight by propagating gradients backward through the network.Step 2: Eliminate wrong options
It updates the weights directly without considering the gradient. is incorrect because the chain rule involves gradients. It prevents the vanishing gradient problem by normalizing gradients. is incorrect because it doesn't address vanishing gradients directly. It ensures that the learning rate is adaptive for each layer. is incorrect because the chain rule is not about adaptive learning rates.Final Answer:
Option B -> Option BQuick Check:
Chain rule computes gradients for weights. [OK]
Hint: Chain rule computes gradients for weights. [OK]
Common Mistakes:
2. Given the following Python code, what is the output when evaluating the calibration of a model using Brier Score?
from sklearn.metrics import brier_score_loss
true_labels = [0, 1, 1, 0]
predicted_probs = [0.1, 0.9, 0.8, 0.4]
score = brier_score_loss(true_labels, predicted_probs)
print(score)easy
Solution
Step 1: Understand Brier Score calculation.
Brier Score is the mean squared difference between predicted probabilities and actual outcomes.Step 2: Calculate the score.
For each pair: (0.1-0)^2, (0.9-1)^2, (0.8-1)^2, (0.4-0)^2. Mean = (0.01 + 0.01 + 0.04 + 0.16) / 4 = 0.055.Final Answer:
Option D -> Option DQuick Check:
Brier Score = mean squared error of probabilities. [OK]
Hint: Brier Score = mean squared error of probabilities. [OK]
Common Mistakes:
3. Given the following Python code snippet using a pre-trained YOLO model, what will be the output shape of the detection results?
import torch
from torchvision.models.detection import yolo_v3
model = yolo_v3(pretrained=True)
model.eval()
input_tensor = torch.rand(1, 3, 416, 416)
output = model(input_tensor)
print(output[0]['boxes'].shape)easy
Solution
Step 1: Understand YOLO output
YOLO outputs a list of detections, each with a bounding box of 4 coordinates.Step 2: Determine output shape
The shape is (N, 4) where N is the number of detected objects.Final Answer:
Option B -> Option BQuick Check:
YOLO boxes = (N, 4) [OK]
Hint: YOLO boxes = (N, 4) [OK]
Common Mistakes:
4. A model trained with Adam optimizer is not converging. What is the most likely cause?
medium
Solution
Step 1: Identify common issues with Adam.
Adam can be sensitive to high learning rates, causing divergence.Step 2: Eliminate less likely causes.
Adam handles non-convex problems well, and batch size/weight decay are less likely to cause non-convergence.Final Answer:
Option B -> Option BQuick Check:
High lr can cause Adam to diverge. [check]
Hint: High lr can cause Adam to diverge. [check]
Common Mistakes:
5. In a system where data distribution shifts gradually over time, how should you design the learning process?
hard
Solution
Step 1: Consider the nature of gradual shifts.
Gradual shifts require a system that can adapt over time without waiting for performance to drop significantly.Step 2: Evaluate the options.
Use periodic retraining with a fixed schedule regardless of data shifts. is incorrect because a fixed schedule may not align with shifts. Use continual learning without any additional mechanisms. is incorrect because continual learning alone may not handle shifts effectively. Use periodic retraining only when performance drops significantly. is incorrect because waiting for performance drops can lead to suboptimal results.Final Answer:
Option C -> Option CQuick Check:
Adapt to shifts with detection. [OK]
Hint: Adapt to shifts with detection. [OK]
Common Mistakes:
