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. In the context of Graph Neural Networks, which component is primarily responsible for aggregating information from neighboring nodes?
easy
Solution
Step 1: Identify the role of each component
The message passing mechanism is designed to aggregate information from neighboring nodes in a graph.Step 2: Eliminate wrong options
Activation functions, dropout layers, and batch normalization do not specifically aggregate information from neighboring nodes.Final Answer:
Option C -> Option CQuick Check:
Message passing aggregates neighbor info in GNNs. [check]
Hint: Message passing aggregates neighbor info in GNNs. [check]
Common Mistakes:
3. Given the following Python code snippet, what will be the output?
import numpy as np
data = np.array([1, 2, 3, 4, 5])
# Simulate offline data processing
processed_data = data * 2
print(processed_data)easy
Solution
Step 1: Understand the code operation
The code multiplies each element of the array by 2.Step 2: Calculate the expected output
Each element in the array [1, 2, 3, 4, 5] is multiplied by 2, resulting in [2, 4, 6, 8, 10].Final Answer:
Option B -> Option BQuick Check:
Array * 2 doubles each element. [OK]
Hint: Array * 2 doubles each element. [OK]
Common Mistakes:
4. In the context of why machine learning exists, which of the following problems is most suitable for a machine learning approach rather than a rule-based system?
easy
Solution
Step 1: Identify the nature of the problem.
Predicting the next word in a sentence involves understanding context and patterns, which are complex and not easily defined by rules.Step 2: Eliminate rule-based problems.
Options A, C, and D are deterministic and can be solved with explicit algorithms.Final Answer:
Option A -> Option AQuick Check:
ML for patterns, rules for logic. [OK]
Hint: ML excels at pattern recognition, not deterministic logic. [OK]
Common Mistakes:
5. You notice that your XGBoost model is overfitting despite using early stopping. What could be the root cause?
medium
Solution
Step 1: Identify overfitting causes
Overfitting can occur if the model is too complex, such as having trees with high max depth.Step 2: Eliminate wrong options
The learning rate is too low, causing the model to converge slowly. is incorrect because a low learning rate would not cause overfitting. The number of boosting rounds is too low, leading to underfitting. is incorrect because too few rounds would cause underfitting, not overfitting. The regularization parameters are set too high, restricting model complexity. is incorrect because high regularization would prevent overfitting, not cause it.Final Answer:
Option A -> Option AQuick Check:
High max depth = Overfitting risk [OK]
Hint: High max depth = Overfitting risk [OK]
Common Mistakes:
