Practice
1. In the context of dropout regularization, what happens to the dropout rate during inference?
easy
Solution
Step 1: Understand dropout behavior during inference
During inference, dropout is not applied, meaning the dropout rate is effectively zero.Step 2: Eliminate wrong options
The dropout rate is increased to improve generalization. is incorrect because increasing dropout during inference would not improve generalization. The dropout rate remains the same as during training. is incorrect because dropout is not applied during inference. The dropout rate is adjusted based on validation performance. is incorrect because dropout rate is not adjusted based on validation performance during inference.Final Answer:
Option A -> Option AQuick Check:
Dropout off during inference. [OK]
Hint: Dropout off during inference. [OK]
Common Mistakes:
2. Given the following Python code snippet, what will be the output?
import numpy as np
from sklearn.utils import resample
X = np.array([[1, 2], [3, 4], [5, 6]])
y = np.array([0, 0, 1])
X_resampled, y_resampled = resample(X, y, replace=True, n_samples=6, stratify=y)
print(y_resampled)easy
Solution
Step 1: Understand stratified resampling.
Stratified resampling maintains the class distribution in the resampled dataset.Step 2: Calculate expected output.
Original distribution is 2:1, so resampled should be 4:2.Final Answer:
Option B -> Option BQuick Check:
Stratified resampling keeps class ratios. [OK]
Hint: Stratified resampling keeps class ratios. [OK]
Common Mistakes:
3. For a recurrent neural network (RNN) model, which normalization technique is generally more suitable and why?
medium
Solution
Step 1: Consider the structure of RNNs.
RNNs process sequences, and Batch Normalization can disrupt temporal dependencies due to its reliance on batch statistics.Step 2: Evaluate normalization techniques.
Layer Normalization is more suitable as it normalizes across features within each timestep, preserving sequence information.Final Answer:
Option D -> Option DQuick Check:
Layer Norm for RNNs to preserve sequence info. [OK]
Hint: Layer Norm for RNNs to preserve sequence info. [OK]
Common Mistakes:
4. When choosing between Least Squares and Gradient Descent for linear regression, which scenario makes Gradient Descent more suitable?
medium
Solution
Step 1: Identify the constraint
Gradient Descent is more suitable for large datasets that don't fit in memory because it can process data in batches.Step 2: Eliminate wrong options
Least Squares is efficient for small datasets (A), interpretability is not a deciding factor (C), and noise handling depends on regularization, not the optimization method (D).Final Answer:
Option C -> Option CQuick Check:
Gradient Descent handles large datasets in batches. [OK]
Hint: Gradient Descent handles large datasets in batches. [OK]
Common Mistakes:
5. You are designing a deep learning model for a task with highly imbalanced classes. Which approach should you take to ensure effective gradient flow and model performance?
hard
Solution
Step 1: Address gradient flow and class imbalance
Batch normalization helps stabilize learning by normalizing inputs to each layer, which can improve gradient flow and model performance.Step 2: Eliminate wrong options
Increase the batch size to include more samples. is incorrect because increasing batch size doesn't directly address gradient flow. Use a sigmoid activation function for all layers. can exacerbate vanishing gradients. Apply dropout to prevent overfitting. is more about regularization than gradient flow.Final Answer:
Option A -> Option AQuick Check:
Batch norm stabilizes learning and gradients. [OK]
Hint: Batch norm stabilizes learning and gradients. [OK]
Common Mistakes:
