Practice
import numpy as np
data = np.array([1, 2, 3, 4, 5])
mask = data > 3
result = data[mask]
print(result)Solution
Step 1: Understand the code logic
The mask is applied to filter elements greater than 3.Step 2: Determine the output
Only elements 4 and 5 satisfy the condition, so result is [4, 5].Final Answer:
Option A -> Option AQuick Check:
Mask filters elements > 3. [OK]
Solution
Step 1: Identify the discrepancy
Good validation performance but poor test performance suggests a mismatch between sets.Step 2: Eliminate less likely causes
The model is underfitting the data. is incorrect as underfitting would affect both sets. The validation set is too small. is less likely unless the validation set is extremely small. The model has too many parameters. would likely affect both sets similarly.Final Answer:
Option A -> Option AQuick Check:
Mismatch between validation and test sets. [OK]
Solution
Step 1: Evaluate computational needs
Semantic segmentation is generally less computationally intensive than instance or panoptic segmentation.Step 2: Eliminate wrong options
Instance segmentation is more detailed and resource-heavy, panoptic combines both, and object detection is not segmentation.Final Answer:
Option C -> Option CQuick Check:
Semantic = Less computation than instance [OK]
Solution
Step 1: Identify common convergence issues
A high learning rate can cause the model to overshoot the minimum, preventing convergence.Step 2: Eliminate wrong options
A small dataset (B) or too many features (C) might affect performance but not convergence. Initial weights being zero (D) is not a convergence issue.Final Answer:
Option B -> Option BQuick Check:
High learning rate can prevent convergence. [OK]
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]
