Practice
1. In a deep learning model, when is it more appropriate to use Layer Normalization instead of Batch Normalization?
easy
Solution
Step 1: Understand the context of normalization techniques.
Batch Normalization relies on batch statistics, which can be unstable with small batch sizes. Layer Normalization uses layer statistics, making it more stable for small batches or online learning.Step 2: Eliminate wrong options.
When the model is trained on a very large batch size. is incorrect because large batch sizes are suitable for Batch Normalization. When the model has a very deep architecture. is incorrect because depth doesn't directly affect the choice between these normalizations. When the model is trained on a balanced dataset. is irrelevant to normalization choice.Final Answer:
Option B -> Option BQuick Check:
Layer Norm for small batches or online learning. [OK]
Hint: Layer Norm for small batches or online learning. [OK]
Common Mistakes:
2. In a regression problem where outliers are present, which metric is generally more robust to these outliers?
easy
Solution
Step 1: Understand the impact of outliers on metrics.
MAE is less sensitive to outliers compared to MSE and RMSE because it doesn't square the errors.Step 2: Eliminate wrong options.
MSE and RMSE are sensitive to outliers due to squaring errors. MAPE is not suitable for zero or near-zero values.Final Answer:
Option D -> Option DQuick Check:
MAE handles outliers better than MSE. [OK]
Hint: MAE is less sensitive to outliers than MSE. [OK]
Common Mistakes:
3.
import numpy as np
from sklearn.cluster import KMeans
X = np.array([[1, 2], [1, 4], [1, 0],
[4, 2], [4, 4], [4, 0]])
kmeans = KMeans(n_clusters=2, random_state=0).fit(X)
print(kmeans.labels_)What does the code output?easy
Solution
Step 1: Understand KMeans clustering.
KMeans assigns labels based on proximity to cluster centers.Step 2: Analyze the data points.
Points [1, 2], [1, 4], [1, 0] are closer to one center, and [4, 2], [4, 4], [4, 0] to another.Final Answer:
Option A -> Option AQuick Check:
Cluster proximity determines labels [OK]
Hint: Cluster proximity determines labels [OK]
Common Mistakes:
4. For a dataset with significant outliers, which scaling method is more appropriate and why?
medium
Solution
Step 1: Consider the effect of outliers on scaling methods.
Normalization is sensitive to outliers as it scales data to a fixed range.Step 2: Choose the method less affected by outliers.
Standardization is less affected because it centers data around the mean and scales by standard deviation.Final Answer:
Option D -> Option DQuick Check:
Standardize for outliers, less sensitive. [OK]
Hint: Standardize for outliers, less sensitive. [OK]
Common Mistakes:
5. For a regression task with a large number of outliers, which metric would be more appropriate to use?
medium
Solution
Step 1: Consider the impact of outliers on metrics.
Huber Loss is less sensitive to outliers than MSE and RMSE.Step 2: Eliminate wrong options.
MSE and RMSE amplify outliers due to squaring. MAPE is not suitable for zero or near-zero values.Final Answer:
Option B -> Option BQuick Check:
Huber Loss balances sensitivity to outliers. [OK]
Hint: Huber Loss balances sensitivity to outliers. [OK]
Common Mistakes:
