Practice
1. Given the following Python code using Word2Vec, what is the output shape of the word vector for 'king'?
from gensim.models import Word2Vec
model = Word2Vec(sentences, vector_size=100, window=5, min_count=1, workers=4)
vector = model.wv['king']easy
Solution
Step 1: Understand Word2Vec output
The Word2Vec model returns a 1D array of the specified vector size for each word.Step 2: Determine the shape
The vector size is set to 100, so the output shape is (100,).Final Answer:
Option C -> Option CQuick Check:
Word2Vec outputs 1D vector of size [OK]
Hint: Word2Vec outputs 1D vector of size [OK]
Common Mistakes:
2. In the context of Random Forests, what is the primary purpose of using bagging?
easy
Solution
Step 1: Understand bagging's role
Bagging, or Bootstrap Aggregating, is used to reduce variance by averaging predictions from multiple models trained on different subsets of the data.Step 2: Eliminate wrong options
To increase the model's interpretability is incorrect because bagging does not inherently increase interpretability. To enhance the model's feature selection is wrong as feature selection is not the primary goal of bagging. To improve the model's computational efficiency is incorrect because bagging typically increases computational cost due to multiple models.Final Answer:
Option D -> Option DQuick Check:
Bagging reduces variance by averaging. [OK]
Hint: Bagging reduces variance by averaging. [OK]
Common Mistakes:
3. A model trained with weak supervision is underperforming. What is the most likely cause?
medium
Solution
Step 1: Identify the weak supervision challenge.
Weak supervision relies on heuristics, which can be a source of error if too simplistic.Step 2: Eliminate other causes.
Model complexity and dataset size are less likely to be the primary issue in weak supervision. Learning rate affects training stability, not heuristic quality.Final Answer:
Option A -> Option AQuick Check:
Weak supervision = heuristic quality [OK]
Hint: Weak supervision = heuristic quality [OK]
Common Mistakes:
4. A recurrent neural network is not learning effectively. The loss plateaus early during training. What is the most likely cause?
medium
Solution
Step 1: Identify symptoms of vanishing gradient.
Early plateauing of loss often indicates vanishing gradients.Step 2: Eliminate other causes.
High learning rate (A) would cause erratic loss, overfitting (B) would show low training loss, and small dataset (D) would not cause early plateau.Final Answer:
Option C -> Option CQuick Check:
Early plateau = vanishing gradient. [check]
Hint: Early plateau = vanishing gradient. [check]
Common Mistakes:
5. You are designing a recommendation system for a video platform. Which metric would best capture user satisfaction if users tend to watch only the first few recommended videos?
hard
Solution
Step 1: Understand user behavior
Users watching only the first few videos means early precision is crucial.Step 2: Choose the metric
Precision at K directly measures the quality of the top K recommendations, aligning with user behavior.Final Answer:
Option A -> Option AQuick Check:
Precision at K focuses on top results. [OK]
Hint: Precision at K focuses on top results. [OK]
Common Mistakes:
