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 deep learning, why might a deep network be preferred over a shallow network for complex tasks?
easy
Solution
Step 1: Understand the advantage of deep networks
Deep networks can capture hierarchical features, which is crucial for complex tasks.Step 2: Eliminate wrong options
Deep networks can represent any function with fewer parameters. is incorrect because deep networks do not always use fewer parameters. Shallow networks are always faster to train. is incorrect as shallow networks are not always faster. Shallow networks generalize better on all tasks. is incorrect because shallow networks do not always generalize better.Final Answer:
Option B -> Option BQuick Check:
Deep networks capture hierarchies. [OK]
Hint: Deep networks capture hierarchies. [OK]
Common Mistakes:
3. When choosing between Word2Vec and BERT for a text classification task, which scenario makes Word2Vec a better choice?
medium
Solution
Step 1: Compare Word2Vec and BERT
Word2Vec is less resource-intensive and faster than BERT, which is beneficial when resources are limited.Step 2: Eliminate wrong options
Options A, C, and D require deep contextual understanding, which BERT handles better than Word2Vec.Final Answer:
Option B -> Option BQuick Check:
Word2Vec for speed, BERT for context [OK]
Hint: Word2Vec for speed, BERT for context [OK]
Common Mistakes:
4. A deployed model is showing unexpected behavior with high variance in predictions. What is the most likely cause?
medium
Solution
Step 1: Identify the symptom.
High variance in predictions suggests the model is not generalizing well.Step 2: Determine the most likely cause.
Data drift, where the input data distribution changes over time, is a common cause of unexpected behavior in production.Final Answer:
Option D -> Option DQuick Check:
Data drift causes unexpected variance. [OK]
Hint: Data drift causes unexpected variance. [OK]
Common Mistakes:
5. You are designing a system to predict stock prices using both historical and real-time data. Which approach best integrates these data sources effectively?
hard
Solution
Step 1: Identify the need for integration
A hybrid system allows for leveraging the strengths of both historical and real-time data.Step 2: Evaluate the options
Use a batch processing system to handle both data types simultaneously. does not effectively integrate real-time updates. Train separate models for historical and real-time data and average their predictions. may lead to inconsistent predictions. Rely solely on real-time data for predictions to ensure up-to-date results. ignores valuable historical data.Final Answer:
Option A -> Option AQuick Check:
Hybrid systems leverage both data types effectively. [OK]
Hint: Hybrid systems leverage both data types effectively. [OK]
Common Mistakes:
