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 high-dimensional data, which of the following is a primary reason why the curse of dimensionality affects nearest neighbor algorithms?
easy
Solution
Step 1: Understand the curse of dimensionality.
In high dimensions, the distance between points becomes less informative.Step 2: Eliminate wrong options.
High-dimensional data increases the risk of overfitting. is about overfitting, not distance. High-dimensional data requires more computational resources. is about computation, not distance. High-dimensional data leads to more complex decision boundaries. is about decision boundaries, not distance.Final Answer:
Option A -> Option AQuick Check:
High dimensions dilute distance meaning. [OK]
Hint: High dimensions dilute distance meaning. [OK]
Common Mistakes:
3. In the context of the No Free Lunch Theorem, which statement is true about model performance across different datasets?
easy
Solution
Step 1: Understand the No Free Lunch Theorem
The theorem states that no single model is universally best across all datasets.Step 2: Eliminate wrong options
A model that performs well on one dataset will perform well on all datasets. is incorrect because model performance varies by dataset. The best model for a dataset can be determined without testing. is incorrect because testing is necessary to determine the best model. A complex model always outperforms a simple model. is incorrect because complexity does not guarantee better performance.Final Answer:
Option B -> Option BQuick Check:
No universal best model. [OK]
Hint: No universal best model. [OK]
Common Mistakes:
4. In a real-time system where predictions need to be made quickly, which approach to linear regression is more suitable and why?
hard
Solution
Step 1: Consider real-time constraints
Stochastic Gradient Descent (SGD) updates weights after each data point, allowing for faster, more frequent updates suitable for real-time systems.Step 2: Eliminate wrong options
Batch Gradient Descent (A) is too slow for real-time, Least Squares (C) is not iterative, and Mini-batch (D) is a compromise but not as fast as SGD.Final Answer:
Option A -> Option AQuick Check:
SGD updates weights after each data point. [OK]
Hint: SGD updates weights after each data point. [OK]
Common Mistakes:
5. You need to design a recurrent neural network for a real-time translation system. Which approach would best handle the vanishing gradient problem while maintaining low latency?
hard
Solution
Step 1: Consider latency and vanishing gradient.
GRUs are simpler and faster, reducing latency while handling vanishing gradients.Step 2: Evaluate other options.
Deep LSTM (A) increases latency, standard RNN (C) struggles with gradients, bidirectional LSTM (D) adds complexity and latency.Final Answer:
Option B -> Option BQuick Check:
GRU: fast, handles vanishing gradients. [check]
Hint: GRU: fast, handles vanishing gradients. [check]
Common Mistakes:
