Practice
1. In a scenario where training time is critical, which approach is better for implementing early stopping?
medium
Solution
Step 1: Consider training time constraints
In time-critical scenarios, stopping early can save resources.Step 2: Choose the appropriate patience value
A small patience value allows for quicker termination if no improvement is seen, aligning with the need to save time.Final Answer:
Option A -> Option AQuick Check:
Small patience saves time in critical scenarios. [OK]
Hint: Small patience saves time in critical scenarios. [OK]
Common Mistakes:
2.
import numpy as np
# Backpropagation for a single neuron
inputs = np.array([1.0, 2.0, 3.0])
weights = np.array([0.2, 0.8, -0.5])
bias = 2.0
learning_rate = 0.01
d_output = np.array([1.0]) # Gradient of loss w.r.t output
# Incorrect gradient calculation
weights_gradient = d_output * inputs
weights -= learning_rate * weights_gradient
print(weights)medium
Solution
Step 1: Identify error in gradient calculation
The code incorrectly applies the gradient directly without considering the chain rule.Step 2: Correct approach
Should multiply by the derivative of the activation function.Final Answer:
Option D -> Option DQuick Check:
Always apply chain rule in backpropagation [OK]
Hint: Always apply chain rule in backpropagation [OK]
Common Mistakes:
3. In a PCA implementation, you need to project data onto the first two principal components. Which approach is correct?
medium
Solution
Step 1: Understand projection in PCA
Projection involves multiplying the data matrix by the eigenvectors corresponding to the desired components.Step 2: Eliminate wrong options
Multiply the data matrix by the first two eigenvalues. is incorrect because eigenvalues are not used for projection. Multiply the covariance matrix by the first two eigenvectors. and D incorrectly use the covariance matrix instead of the data matrix.Final Answer:
Option A -> Option AQuick Check:
Project data using eigenvectors, not eigenvalues. [OK]
Hint: Project data using eigenvectors, not eigenvalues. [OK]
Common Mistakes:
4. You implemented a Skip-Gram model with negative sampling, but the loss is not decreasing. What is the most likely cause?
medium
Solution
Step 1: Analyze the symptoms
A non-decreasing loss often indicates issues with learning rate or gradient updates.Step 2: Evaluate each option
High learning rates can cause oscillations, preventing loss reduction. Random initialization and sample randomness are less likely to cause this specific issue.Final Answer:
Option D -> Option DQuick Check:
High learning rate can cause loss oscillation [OK]
Hint: High learning rate can cause loss oscillation [OK]
Common Mistakes:
5. How can you optimize the memory usage of the Adam optimizer in a large-scale deep learning model?
hard
Solution
Step 1: Identify memory-intensive components
Adam requires storing additional momentum and velocity arrays, which can be memory-intensive.Step 2: Optimize storage precision
Using half-precision floating points reduces memory usage significantly while maintaining sufficient precision for most deep learning tasks.Final Answer:
Option B -> Option BQuick Check:
Use half-precision to save memory in Adam [OK]
Hint: Use half-precision to save memory in Adam [OK]
Common Mistakes:
