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 Word2Vec, which of the following best describes the purpose of the 'skip-gram' model?
easy
Solution
Step 1: Understand skip-gram model purpose
The skip-gram model in Word2Vec is designed to predict surrounding words given a target word.Step 2: Eliminate wrong options
Predicts the next word in a sequence given the previous words. describes a language model task, Clusters words into predefined categories. is about clustering, and Generates a sequence of words from a given context. is about sequence generation, none of which are the purpose of skip-gram.Final Answer:
Option D -> Option DQuick Check:
Skip-gram predicts context from target [OK]
Hint: Skip-gram predicts context from target [OK]
Common Mistakes:
3. In the context of data collection for machine learning, which scenario best describes an offline data collection approach?
easy
Solution
Step 1: Identify offline data collection characteristics
Offline data collection involves gathering data that has already been generated and stored, not in real-time.Step 2: Eliminate real-time options
Options A, C, and D involve real-time or near-real-time data collection, which is characteristic of online data collection.Final Answer:
Option D -> Option DQuick Check:
Offline = historical, stored data. [OK]
Hint: Offline = historical, stored data. [OK]
Common Mistakes:
4. A decision tree model is overfitting the training data. What is the most likely cause?
medium
Solution
Step 1: Identify overfitting causes.
Overfitting often occurs when the model is too complex, such as a deep tree.Step 2: Eliminate wrong options.
A shallow tree would underfit, a small dataset affects generalization but not directly overfitting, and uninformative features would lead to poor performance, not overfitting.Final Answer:
Option D -> Option DQuick Check:
Deep trees overfit easily. [OK]
Hint: Deep trees overfit easily. [OK]
Common Mistakes:
5. You are tasked with debugging a production model that suddenly started underperforming. Which approach is most effective in systematically diagnosing the issue?
hard
Solution
Step 1: Identify potential causes
Sudden performance drops often relate to changes in data or environment.Step 2: Choose a systematic approach
Checking for changes in data preprocessing is a logical first step to identify if the input data has changed.Final Answer:
Option A -> Option AQuick Check:
Sudden drop = check data changes [OK]
Hint: Sudden drop = check data changes [OK]
Common Mistakes:
