Practice
1. Given the following PyTorch code snippet, what will be the output shape of the tensor after applying dropout during training?
import torch
import torch.nn as nn
x = torch.ones(5, 5)
dropout = nn.Dropout(p=0.5)
output = dropout(x)easy
Solution
Step 1: Understand dropout effect
Dropout randomly sets some elements to zero during training, while scaling the remaining elements.Step 2: Eliminate wrong options
(5, 5) with all elements halved is incorrect because not all elements are halved; only non-zero elements are scaled. (5, 5) with all elements set to zero is incorrect because not all elements are set to zero. (5, 5) with some elements doubled is incorrect because elements are not doubled.Final Answer:
Option C -> Option CQuick Check:
Dropout zeros some elements. [OK]
Hint: Dropout zeros some elements. [OK]
Common Mistakes:
2. In the context of feature engineering, which of the following techniques is most suitable for handling categorical variables with high cardinality?
easy
Solution
Step 1: Identify the challenge with high cardinality.
High cardinality in categorical variables can lead to a large number of features when using one-hot encoding.Step 2: Evaluate each option.
One-hot encoding (A) creates too many features. Label encoding (B) imposes an ordinal relationship. Binary encoding (D) reduces dimensionality but not as effectively as target encoding (C), which uses the target variable to encode categories, reducing dimensionality and capturing information.Final Answer:
Option C -> Option CQuick Check:
Target encoding handles high cardinality efficiently. [OK]
Hint: Target encoding handles high cardinality efficiently. [OK]
Common Mistakes:
3. A panoptic segmentation model is producing poor results with overlapping instances. What is the most likely cause of this issue?
medium
Solution
Step 1: Identify the segmentation issue
Poor results with overlapping instances suggest a failure in distinguishing between semantic and instance tasks.Step 2: Eliminate wrong options
Model depth and data diversity affect general performance, not specific task distinction; learning rate affects convergence, not task separation.Final Answer:
Option D -> Option DQuick Check:
Overlapping = Task distinction problem [OK]
Hint: Overlapping = Task distinction problem [OK]
Common Mistakes:
4. A model performs well offline but poorly online. What is the most likely cause of this discrepancy?
medium
Solution
Step 1: Analyze the difference between offline and online environments.
Offline evaluation uses historical data, while online evaluation deals with live data, which may have a different distribution.Step 2: Eliminate other potential causes.
The model is overfitting to the training data. is incorrect because overfitting would likely affect both offline and online performance. The model's hyperparameters are not optimized. is incorrect because hyperparameter optimization affects both environments. The offline evaluation used an incorrect metric. is incorrect because using an incorrect metric would not cause a discrepancy between environments.Final Answer:
Option A -> Option AQuick Check:
Different data distribution online. [OK]
Hint: Different data distribution online. [OK]
Common Mistakes:
5. You are tasked with designing a GNN for a dynamic graph where nodes and edges change over time. Which approach would best handle this scenario?
hard
Solution
Step 1: Understand the graph dynamics
Dynamic graphs require models that can adapt to changes in nodes and edges.Step 2: Evaluate each approach
Static GCNs and fixed adjacency matrices cannot adapt to changes, and RNNs are not designed for graph structures.Final Answer:
Option A -> Option AQuick Check:
Dynamic GNNs adapt to graph changes. [check]
Hint: Dynamic GNNs adapt to graph changes. [check]
Common Mistakes:
