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 the No Free Lunch Theorem, which statement is true about model performance across different datasets?
easy
Solution
Step 1: Understand the No Free Lunch Theorem
The theorem states that no single model is universally best across all datasets.Step 2: Eliminate wrong options
A model that performs well on one dataset will perform well on all datasets. is incorrect because model performance varies by dataset. The best model for a dataset can be determined without testing. is incorrect because testing is necessary to determine the best model. A complex model always outperforms a simple model. is incorrect because complexity does not guarantee better performance.Final Answer:
Option B -> Option BQuick Check:
No universal best model. [OK]
Hint: No universal best model. [OK]
Common Mistakes:
3. In the context of transfer learning, why is it beneficial to pretrain a model on a large dataset before fine-tuning it on a smaller, task-specific dataset?
easy
Solution
Step 1: Understand the purpose of pretraining.
Pretraining allows the model to learn general features from a large dataset.Step 2: Eliminate wrong options.
Pretraining ensures the model learns task-specific features from the start. is incorrect because pretraining focuses on general, not task-specific, features. Pretraining reduces the need for any further training on the task-specific dataset. is incorrect because fine-tuning is still necessary. Pretraining is only useful for models with a large number of parameters. is incorrect because pretraining is beneficial regardless of model size.Final Answer:
Option A -> Option AQuick Check:
Pretrain for general features, fine-tune for specific tasks. [check]
Hint: Pretrain for general features, fine-tune for specific tasks. [check]
Common Mistakes:
4. A production ML model's performance has unexpectedly dropped. What is the most likely root cause?
medium
Solution
Step 1: Identify common causes of performance drop
Data drift is a frequent cause of unexpected performance drops.Step 2: Eliminate wrong options
The model's hyperparameters were not tuned properly. would cause issues from the start. The model architecture is outdated. is less likely to cause sudden drops. The training dataset was too small. affects initial performance, not sudden changes.Final Answer:
Option D -> Option DQuick Check:
Sudden drop? Check data distribution first [OK]
Hint: Sudden drop? Check data distribution first [OK]
Common Mistakes:
5. A deployed model is showing unexpected behavior with high variance in predictions. What is the most likely cause?
medium
Solution
Step 1: Identify the symptom.
High variance in predictions suggests the model is not generalizing well.Step 2: Determine the most likely cause.
Data drift, where the input data distribution changes over time, is a common cause of unexpected behavior in production.Final Answer:
Option D -> Option DQuick Check:
Data drift causes unexpected variance. [OK]
Hint: Data drift causes unexpected variance. [OK]
Common Mistakes:
