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. A model trained on a dataset with engineered features is underperforming on the validation set. What is the most likely cause?
medium
Solution
Step 1: Analyze the symptoms of underperformance.
Underperformance on validation suggests overfitting or poor generalization.Step 2: Evaluate the role of feature engineering.
Over-engineered features (C) can lead to overfitting, especially if they capture noise. Normalization (B) affects convergence but not generalization directly. Model complexity (A, D) is less likely the issue if features are the focus.Final Answer:
Option B -> Option BQuick Check:
Over-engineered features often lead to overfitting. [OK]
Hint: Over-engineered features often lead to overfitting. [OK]
Common Mistakes:
3. When choosing between online and offline data collection for a recommendation system, which factor is most critical for deciding to use online data collection?
medium
Solution
Step 1: Identify the key factor for online data collection
Online data collection is crucial when real-time feedback is needed to update recommendations dynamically.Step 2: Eliminate factors not specific to online collection
Options B, C, and D do not specifically require online data collection; they can be addressed with offline methods.Final Answer:
Option A -> Option AQuick Check:
Real-time needs = online collection. [OK]
Hint: Real-time needs = online collection. [OK]
Common Mistakes:
4. When dealing with high-dimensional data, which approach is more suitable for reducing dimensionality while preserving variance?
medium
Solution
Step 1: Identify the goal of preserving variance.
PCA is designed to reduce dimensions while preserving variance.Step 2: Eliminate wrong options.
Use L1 regularization to select features. selects features, not reduce dimensions. Use k-means clustering to group similar data points. clusters data, not reduce dimensions. Apply dropout to randomly ignore features during training. is for regularization, not dimensionality reduction.Final Answer:
Option C -> Option CQuick Check:
PCA reduces dimensions, keeps variance. [OK]
Hint: PCA reduces dimensions, keeps variance. [OK]
Common Mistakes:
5. You are tasked with designing a CNN for a medical imaging application where interpretability is crucial. Which approach would best leverage the inductive bias of CNNs for this task?
hard
Solution
Step 1: Consider interpretability needs
Small kernels with more layers help capture local patterns, which are crucial for interpretability in medical imaging.Step 2: Eliminate wrong options
Use very deep networks to capture complex patterns is incorrect because very deep networks can be less interpretable. Use shallow networks with large kernels to capture global patterns is incorrect as large kernels reduce local detail capture. Use networks with attention mechanisms to highlight important regions is incorrect because attention mechanisms, while useful, are not leveraging CNN's inductive bias.Final Answer:
Option A -> Option AQuick Check:
Small kernels capture local details, aiding interpretability. [OK]
Hint: Small kernels capture local details, aiding interpretability. [OK]
Common Mistakes:
