Practice
1. Given the following Python code snippet, what will be the output if the input data has undergone covariate drift?
import numpy as np
from sklearn.linear_model import LinearRegression
X_train = np.array([[1, 2], [2, 3], [3, 4]])
y_train = np.array([3, 5, 7])
model = LinearRegression().fit(X_train, y_train)
X_test = np.array([[4, 5], [5, 6]])
predictions = model.predict(X_test)
print(predictions)easy
Solution
Step 1: Understand the impact of covariate drift.
Covariate drift affects the input distribution, leading to biased predictions.Step 2: Eliminate wrong options.
The model won't throw an error (The model will throw an error.) and predictions won't be accurate (The predictions will be accurate.) or unaffected (The predictions will be unaffected by covariate drift.) due to drift.Final Answer:
Option D -> Option DQuick Check:
Covariate drift biases predictions [OK]
Hint: Covariate drift biases predictions [OK]
Common Mistakes:
2. In the context of gradient boosting, which of the following is a key advantage of using XGBoost over traditional boosting methods?
easy
Solution
Step 1: Identify XGBoost's unique features
XGBoost is known for its regularization capabilities, which help prevent overfitting.Step 2: Eliminate wrong options
XGBoost uses bagging to improve model accuracy. is incorrect because XGBoost does not use bagging; it uses boosting. XGBoost is designed to handle missing data by default. is incorrect because while XGBoost can handle missing data, this is not its key advantage over traditional boosting. XGBoost uses a single decision tree for predictions. is incorrect because XGBoost uses an ensemble of trees, not a single tree.Final Answer:
Option D -> Option DQuick Check:
XGBoost = Regularization advantage [OK]
Hint: XGBoost = Regularization advantage [OK]
Common Mistakes:
3. 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:
4. When deciding between Platt Scaling and Isotonic Regression for calibrating a model, which scenario favors Isotonic Regression?
medium
Solution
Step 1: Understand the strengths of Isotonic Regression.
Isotonic Regression is non-parametric and assumes monotonicity, making it suitable for small datasets where this assumption holds.Step 2: Evaluate each scenario.
Isotonic Regression is not ideal for overfitting (A) or binary outputs (B), and is less efficient than Platt Scaling (D).Final Answer:
Option A -> Option AQuick Check:
Isotonic = small data, monotonicity. [OK]
Hint: Isotonic = small data, monotonicity. [OK]
Common Mistakes:
5. For a large streaming dataset where you need to maintain a representative sample, which sampling strategy is most appropriate and why?
medium
Solution
Step 1: Identify the need for streaming data handling.
Streaming data requires a strategy that can update samples dynamically.Step 2: Eliminate non-streaming strategies.
Random (A) and Stratified (B) don't handle streaming efficiently. Weighted (D) is for prioritization, not streaming.Final Answer:
Option B -> Option BQuick Check:
Reservoir = Streaming data handling [[check]]
Hint: Reservoir = Streaming data handling [[check]]
Common Mistakes:
