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 snippet, what will be the output if the dataset contains data leakage?
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
model = LogisticRegression()
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
print(accuracy_score(y_test, y_pred))easy
Solution
Step 1: Understand the impact of data leakage
Data leakage often results in overly optimistic performance metrics.Step 2: Analyze the code behavior
The code will execute without errors, but if leakage exists, the model will perform better than it should.Final Answer:
Option D -> Option DQuick Check:
Leakage inflates accuracy [OK]
Hint: Leakage inflates accuracy [OK]
Common Mistakes:
3. In the context of handling class imbalance, which technique is specifically designed to adjust the loss function to focus more on hard-to-classify examples?
easy
Solution
Step 1: Identify the technique that modifies the loss function.
Focal Loss is designed to focus more on hard-to-classify examples by adjusting the loss function.Step 2: Eliminate wrong options.
Oversampling and undersampling adjust the dataset, not the loss function. Cost-sensitive learning modifies the cost, not the focus on hard examples.Final Answer:
Option D -> Option DQuick Check:
Focal Loss focuses on hard examples. [OK]
Hint: Focal Loss focuses on hard examples. [OK]
Common Mistakes:
4. A transformer model is underperforming on a translation task. The model seems to ignore the context of the input sequence. What is the most likely cause?
medium
Solution
Step 1: Identify the role of positional encodings.
Positional encodings provide sequence order information, crucial for context.Step 2: Eliminate wrong options.
The model's attention heads are not properly initialized. is incorrect as initialization affects convergence, not context. The model's feedforward layers are too shallow. is incorrect because feedforward depth affects capacity, not context. The model's dropout rate is too high. is incorrect as dropout affects regularization, not context.Final Answer:
Option B -> Option BQuick Check:
Positional encodings ensure context. [OK]
Hint: Positional encodings ensure context. [OK]
Common Mistakes:
5. When deciding between Platt Scaling and Isotonic Regression for calibrating a model, which scenario favors Isotonic Regression?
medium
Solution
Step 1: Understand the strengths of Isotonic Regression.
Isotonic Regression is non-parametric and assumes monotonicity, making it suitable for small datasets where this assumption holds.Step 2: Evaluate each scenario.
Isotonic Regression is not ideal for overfitting (A) or binary outputs (B), and is less efficient than Platt Scaling (D).Final Answer:
Option A -> Option AQuick Check:
Isotonic = small data, monotonicity. [OK]
Hint: Isotonic = small data, monotonicity. [OK]
Common Mistakes:
