Practice
W after backpropagation?import torch
W = torch.tensor([[1.0, 2.0], [3.0, 4.0]], requires_grad=True)
x = torch.tensor([1.0, 2.0])
y = W @ x
loss = y.sum()
loss.backward()Solution
Step 1: Determine the gradient shape
The gradient ofWwill have the same shape asW, which is (2, 2).Step 2: Eliminate wrong options
(2,) is incorrect because it suggests a vector shape. (2, 1) and D are incorrect because they suggest mismatched dimensions.Final Answer:
Option A -> Option AQuick Check:
Gradient shape matches tensor shape. [OK]
Solution
Step 1: Define data drift
Data drift refers to changes in the statistical properties of input data over time.Step 2: Eliminate wrong options
A sudden drop in model accuracy due to a bug in the code. describes a bug, not data drift. An increase in the model's training time due to larger datasets. is about computational resources, not data properties. A decrease in the model's interpretability over time. is unrelated to data drift.Final Answer:
Option C -> Option CQuick Check:
Data drift = change in data stats [OK]
Solution
Step 1: Identify overfitting causes.
Data leakage during feature selection can lead to overfitting as the model sees information from the validation set.Step 2: Eliminate wrong options.
Too few features usually lead to underfitting. An inappropriate scoring function affects feature ranking, not directly overfitting. High variance can cause overfitting but is not specific to wrapper methods.Final Answer:
Option A -> Option AQuick Check:
Data leakage = overfitting risk. [OK]
Solution
Step 1: Identify the issue.
In reinforcement learning, a poorly defined reward function can lead to suboptimal learning.Step 2: Eliminate wrong options.
The model has too many parameters. is incorrect because parameter count affects complexity, not learning direction. The training data is not labeled. is irrelevant as RL doesn't require labeled data. The model is overfitting to the training data. is less likely as overfitting would show initial improvement.Final Answer:
Option D -> Option DQuick Check:
Poor reward function -> Poor learning [OK]
Solution
Step 1: Consider real-time requirements
Causal inference can integrate real-time data to adapt to changes.Step 2: Eliminate wrong options
Holdout and interleaving are less suited for real-time updates. Cross-validation is not typically used for real-time systems.Final Answer:
Option A -> Option AQuick Check:
Causal inference adapts to real-time changes. [OK]
