Practice
from gensim.models import Word2Vec
model = Word2Vec(sentences, vector_size=100, window=5, min_count=1, workers=4)
vector = model.wv['king']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]
prompt = "Solve: 2 + 2 = ?\nLet's think step by step.\nFirst, we add 2 and 2.\nThe result is:"What will the model likely output?Solution
Step 1: Analyze the prompt
The prompt guides the model to solve the equation step-by-step, leading to the answer.Step 2: Eliminate wrong options
An error due to incomplete prompt. is incorrect as the prompt is complete. The model will output a step-by-step explanation. is incorrect because the prompt already provides steps. The model will output random numbers. is incorrect as the prompt is specific.Final Answer:
Option D -> Option DQuick Check:
Prompt guides to solve 2+2, answer is 4. [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: Analyze pooling impact
Without pooling, feature maps remain large, increasing model complexity and risk of overfitting.Step 2: Eliminate wrong options
Pooling layers are too aggressive, losing important features is incorrect because aggressive pooling would reduce overfitting. Pooling layers are applied after every convolutional layer is incorrect as regular pooling helps reduce overfitting. Pooling layers use a large stride, reducing model complexity is incorrect because large strides reduce complexity, not increase it.Final Answer:
Option B -> Option BQuick Check:
No pooling increases overfitting risk. [OK]
Solution
Step 1: Understand scaling laws
Scaling laws suggest that increasing dataset size often yields better performance improvements than increasing model size under a fixed budget.Step 2: Eliminate wrong options
Increasing the number of layers and B are incorrect because they increase computational cost without necessarily improving performance as effectively as more data. Increasing the learning rate is incorrect because it can lead to instability rather than improved performance.Final Answer:
Option A -> Option AQuick Check:
More data often beats bigger models. [OK]
