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. 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. What is the output of the following Python code snippet using NumPy for logistic regression log-odds calculation?
import numpy as np
coefficients = np.array([0.5, -0.25])
features = np.array([2, 3])
log_odds = np.dot(coefficients, features)
print(log_odds)easy
Solution
Step 1: Calculate the dot product.
The dot product is calculated as (0.5 * 2) + (-0.25 * 3) = 1.0 - 0.75 = 0.25.Step 2: Identify the correct output.
-0.25 is correct because the calculation results in 0.25. 1.25 is incorrect as it suggests a miscalculation. 0.25 is incorrect due to a sign error. 2.75 is incorrect due to a misunderstanding of dot product.Final Answer:
Option A -> Option AQuick Check:
Dot product = sum of products [OK]
Hint: Dot product = sum of products [OK]
Common Mistakes:
4.
import numpy as np
from sklearn.model_selection import train_test_split
X = np.array([[1, 2], [3, 4], [5, 6], [7, 8]])
y = np.array([0, 1, 0, 1])
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=42)
print(X_train.shape, X_test.shape)What is the output of this code snippet?easy
Solution
Step 1: Understand train_test_split behavior.
With test_size=0.5, the data is split equally into train and test sets.Step 2: Calculate expected shapes.
Original data has 4 samples, so both train and test sets will have 2 samples each.Final Answer:
Option C -> Option CQuick Check:
Equal split with test_size=0.5. [OK]
Hint: Equal split with test_size=0.5. [OK]
Common Mistakes:
5. You are choosing between a decision tree and a linear regression model for a dataset with a complex, non-linear relationship. Which model should you choose and why?
medium
Solution
Step 1: Analyze the dataset characteristics
The dataset has a complex, non-linear relationship.Step 2: Choose the appropriate model
Decision trees can capture non-linear relationships, making them suitable for this dataset.Final Answer:
Option C -> Option CQuick Check:
Decision trees capture non-linear patterns. [OK]
Hint: Decision trees capture non-linear patterns. [OK]
Common Mistakes:
