Practice
1.
import torch
x = torch.tensor([-1.0, 0.0, 1.0])
output = torch.nn.functional.relu(x)
print(output)What is the output of this code?easy
Solution
Step 1: Understand ReLU behavior.
ReLU outputs zero for negative inputs and the input itself for non-negative inputs.Step 2: Apply ReLU to each element.
For -1.0, output is 0.0; for 0.0, output is 0.0; for 1.0, output is 1.0.Final Answer:
Option A -> Option AQuick Check:
ReLU zeros negatives, keeps positives. [OK]
Hint: ReLU zeros negatives, keeps positives. [OK]
Common Mistakes:
2. 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:
3. A model registered in MLflow Registry is not showing the expected performance in production. What is the most likely cause?
medium
Solution
Step 1: Analyze potential causes of performance issues
Data discrepancies are a common cause of unexpected model performance.Step 2: Eliminate less likely causes
Incorrect dataset usage is more likely than versioning or packaging issues.Final Answer:
Option D -> Option DQuick Check:
Check dataset consistency [OK]
Hint: Check dataset consistency [OK]
Common Mistakes:
4. In a scenario where computational resources are limited, which optimizer would you choose for faster convergence and why?
medium
Solution
Step 1: Consider optimizer efficiency.
Adam combines the benefits of both AdaGrad and RMSProp, leading to faster convergence.Step 2: Evaluate resource constraints.
Adam is computationally efficient and converges faster than SGD with momentum and AdaGrad.Final Answer:
Option A -> Option AQuick Check:
Adam is efficient for limited resources. [check]
Hint: Adam is efficient for limited resources. [check]
Common Mistakes:
5. In a recommendation system, how would you apply feature engineering to improve the model's ability to capture user-item interactions?
hard
Solution
Step 1: Identify the need for capturing interactions.
Recommendation systems benefit from understanding user-item interactions.Step 2: Evaluate feature engineering techniques.
Collaborative filtering (A) is a model, not feature engineering. One-hot encoding (B) doesn't capture interactions. Normalizing (D) doesn't enhance interaction capture. Interaction terms (C) explicitly model user-item interactions, improving the system's ability to recommend.Final Answer:
Option A -> Option AQuick Check:
Interaction terms enhance user-item interaction capture. [OK]
Hint: Interaction terms enhance user-item interaction capture. [OK]
Common Mistakes:
