Practice
1. In the context of model interpretability, which technique is best suited for explaining individual predictions of a complex model?
easy
Solution
Step 1: Identify the purpose of each technique.
PCA is for dimensionality reduction, K-Means for clustering, and Linear Regression for prediction, not explanation.Step 2: Match the technique to the task.
SHAP is specifically designed to explain individual predictions of complex models.Final Answer:
Option A -> Option AQuick Check:
SHAP explains individual predictions. [OK]
Hint: SHAP explains individual predictions. [OK]
Common Mistakes:
2. In the context of Random Forests, what is the primary purpose of using bagging?
easy
Solution
Step 1: Understand bagging's role
Bagging, or Bootstrap Aggregating, is used to reduce variance by averaging predictions from multiple models trained on different subsets of the data.Step 2: Eliminate wrong options
To increase the model's interpretability is incorrect because bagging does not inherently increase interpretability. To enhance the model's feature selection is wrong as feature selection is not the primary goal of bagging. To improve the model's computational efficiency is incorrect because bagging typically increases computational cost due to multiple models.Final Answer:
Option D -> Option DQuick Check:
Bagging reduces variance by averaging. [OK]
Hint: Bagging reduces variance by averaging. [OK]
Common Mistakes:
3. Given the following Python code snippet for a simplified self-attention mechanism, what is the shape of the output?
import torch
Q = torch.rand(2, 3, 4)
K = torch.rand(2, 4, 4)
V = torch.rand(2, 4, 5)
output = torch.matmul(torch.matmul(Q, K.transpose(-2, -1)), V)easy
Solution
Step 1: Analyze matrix multiplications
The first multiplicationtorch.matmul(Q, K.transpose(-2, -1))results in a shape of (2, 3, 4). The second multiplication with V results in (2, 3, 5).Step 2: Eliminate wrong options
(2, 4, 5) is incorrect because it assumes incorrect dimensions for Q. (2, 3, 4) is incorrect because it doesn't account for the final multiplication with V. (2, 5, 5) is incorrect because it assumes incorrect dimensions for the final output.Final Answer:
Option D -> Option DQuick Check:
Check matrix dimensions after each multiplication. [OK]
Hint: Check matrix dimensions after each multiplication. [OK]
Common Mistakes:
4. When choosing between K-Means and Gaussian Mixture Models (GMM) for clustering, which scenario favors K-Means?
medium
Solution
Step 1: Compare K-Means and GMM
K-Means assumes spherical clusters with similar variance, while GMM can handle different shapes and densities.Step 2: Identify the scenario
Clusters with similar variance and spherical shape describes clusters with similar variance and spherical shape, which is ideal for K-Means.Final Answer:
Option D -> Option DQuick Check:
K-Means loves spherical, similar variance clusters [OK]
Hint: K-Means loves spherical, similar variance clusters [OK]
Common Mistakes:
5. 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:
