Practice
1. In the context of model calibration, which metric is most appropriate to evaluate the probability outputs of a classifier?
easy
Solution
Step 1: Identify the purpose of calibration.
Calibration aims to ensure that predicted probabilities reflect true likelihoods.Step 2: Evaluate each metric.
Accuracy, precision, and F1 score do not consider probability estimates, only classification decisions. Log Loss penalizes incorrect probability estimates, making it suitable for calibration.Final Answer:
Option C -> Option CQuick Check:
Log Loss evaluates probability accuracy. [OK]
Hint: Log Loss evaluates probability accuracy. [OK]
Common Mistakes:
2.
import numpy as np
from sklearn.decomposition import PCA
X = np.array([[1, 2], [3, 4], [5, 6]])
pca = PCA(n_components=1)
X_transformed = pca.fit_transform(X)
print(X_transformed)What is the shape of X_transformed?easy
Solution
Step 1: Understand PCA output shape
PCA reduces the dimensionality of the data to the specified number of components.Step 2: Calculate the expected shape
With 3 samples and 1 component, the output shape is (3, 1).Final Answer:
Option D -> Option DQuick Check:
PCA output shape: (n_samples, n_components) [OK]
Hint: PCA output shape: (n_samples, n_components) [OK]
Common Mistakes:
3. Which regularization technique is most suitable for feature selection in a linear regression model?
easy
Solution
Step 1: Identify the purpose of feature selection.
L1 Lasso regularization can shrink some coefficients to zero, effectively selecting features.Step 2: Eliminate wrong options.
L2 Ridge does not shrink coefficients to zero. Elastic Net combines L1 and L2 but is not as direct for feature selection. Dropout is not used in linear regression.Final Answer:
Option A -> Option AQuick Check:
L1 Lasso zeros coefficients for selection. [OK]
Hint: L1 Lasso zeros coefficients for selection. [OK]
Common Mistakes:
4. You implemented stratified sampling but notice that the sample still has class imbalance. What is the most likely cause?
medium
Solution
Step 1: Identify the stratified sampling requirement.
Stratified sampling requires correct class proportion specification.Step 2: Eliminate unrelated issues.
Random Sampling (B) would not be used if stratified was intended. Data leakage (C) affects model performance, not sampling. Sample size (D) affects variability, not imbalance directly.Final Answer:
Option C -> Option CQuick Check:
Check class proportions in stratified sampling [[check]]
Hint: Check class proportions in stratified sampling [[check]]
Common Mistakes:
5. You need to deploy an object detection model on a mobile device with limited computational resources. Which approach would you take?
hard
Solution
Step 1: Consider resource constraints
Mobile devices require models that are both fast and lightweight.Step 2: Match model to constraints
Tiny YOLO is designed for environments with limited resources, balancing speed and size.Final Answer:
Option A -> Option AQuick Check:
Mobile = Tiny YOLO [OK]
Hint: Mobile = Tiny YOLO [OK]
Common Mistakes:
