Practice
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]
from sklearn.svm import SVC
import numpy as np
X = np.array([[1, 2], [2, 3], [3, 4]])
y = np.array([0, 1, 0])
model = SVC(kernel='linear')
model.fit(X, y)
print(model.support_vectors_)Solution
Step 1: Understand the code execution
The code fits an SVM model with a linear kernel and prints the support vectors.Step 2: Eliminate wrong options
An error due to incorrect kernel specification is incorrect because 'linear' is a valid kernel. The coefficients of the decision boundary is incorrect because the code does not print coefficients. The predicted labels for the input data is incorrect because the code does not predict labels.Final Answer:
Option C -> Option CQuick Check:
Prints support vectors, not predictions [OK]
Solution
Step 1: Compare LSTM and GRU.
GRU is simpler and often faster due to fewer parameters, making it suitable for limited resources.Step 2: Eliminate wrong options.
LSTM's complexity isn't always needed, GRU isn't always more accurate, and LSTM's longer sequence handling isn't a universal advantage.Final Answer:
Option C -> Option CQuick Check:
GRU: fewer parameters, faster. [OK]
Solution
Step 1: Diagnose the issue
High validation accuracy but low test accuracy suggests the validation set may not be representative.Step 2: Eliminate wrong options
The model is underfitting the training data. would affect both validation and test accuracy, The test set is too similar to the training set. would not cause low test accuracy, and The model has too many parameters. would affect both validation and test accuracy similarly.Final Answer:
Option D -> Option DQuick Check:
Small validation set = misleading accuracy [OK]
Solution
Step 1: Address class imbalance and overfitting
Class weights help balance the dataset, and early stopping prevents overfitting by halting training when validation performance stops improving.Step 2: Eliminate wrong options
Use SMOTE to oversample the minority class and increase model complexity. increases complexity, risking overfitting, Downsample the majority class and increase the learning rate. may lead to instability, and Use a simpler model with no regularization. lacks regularization, increasing overfitting risk.Final Answer:
Option C -> Option CQuick Check:
Class weights + early stopping = balanced, robust model [OK]
