Practice
1.
import numpy as np
from sklearn.preprocessing import StandardScaler
X = np.array([[1, 2], [3, 4], [5, 6]])
scaler = StandardScaler()
X_scaled = scaler.fit_transform(X)
print(X_scaled.mean(axis=0))What does this code output?easy
Solution
Step 1: Understand standardization.
StandardScaler standardizes features by removing the mean and scaling to unit variance.Step 2: Calculate the mean of standardized data.
After standardization, the mean of each feature should be 0.Final Answer:
Option C -> Option CQuick Check:
StandardScaler centers data to mean 0. [OK]
Hint: StandardScaler centers data to mean 0. [OK]
Common Mistakes:
2. In the context of evaluating search engine results, which metric is most appropriate for measuring the quality of the top-ranked results?
easy
Solution
Step 1: Understand the focus of each metric
MRR is specifically designed to evaluate the rank of the first relevant result, making it ideal for top-ranked results.Step 2: Eliminate wrong options
MAP considers all relevant documents, NDCG focuses on the entire ranking, and Precision at K is not specific to the first relevant result.Final Answer:
Option A -> Option AQuick Check:
MRR focuses on the first relevant result. [OK]
Hint: MRR focuses on the first relevant result. [OK]
Common Mistakes:
3. In the context of statistical significance testing in ML, which of the following best describes a p-value?
easy
Solution
Step 1: Understand p-value definition
A p-value is the probability of observing the data, or something more extreme, given that the null hypothesis is true.Step 2: Eliminate wrong options
The probability that the null hypothesis is true. is incorrect because p-value is not the probability that the null hypothesis is true. The probability of the alternative hypothesis being true. is incorrect because it does not relate to the alternative hypothesis. The probability of making a Type I error. is incorrect because it confuses p-value with Type I error probability.Final Answer:
Option A -> Option AQuick Check:
P-value is about data given null hypothesis [OK]
Hint: P-value is about data given null hypothesis [OK]
Common Mistakes:
4. In a deep neural network, why might you choose GELU over ReLU?
medium
Solution
Step 1: Compare GELU and ReLU characteristics.
GELU provides smoother gradients due to its probabilistic nature, which can help in convergence.Step 2: Evaluate each option.
GELU is not cheaper (A), doesn't entirely avoid dying neurons (C), and isn't more interpretable (D).Final Answer:
Option D -> Option DQuick Check:
GELU smooths gradients, aids convergence. [OK]
Hint: GELU smooths gradients, aids convergence. [OK]
Common Mistakes:
5. A model trained with K-Fold cross-validation is underperforming on unseen data. What is a likely cause?
medium
Solution
Step 1: Consider data leakage as a common issue.
Data leakage can occur if the same data points appear in both training and validation sets.Step 2: Eliminate wrong options.
Too many folds (A) typically doesn't cause overfitting, too few folds (C) would not cause underperformance on unseen data, model complexity (D) is unrelated to cross-validation setup.Final Answer:
Option B -> Option BQuick Check:
Check for data leakage in CV. [OK]
Hint: Check for data leakage in CV. [OK]
Common Mistakes:
