Practice
1. In the context of cross-validation, which method is most appropriate for imbalanced datasets?
easy
Solution
Step 1: Identify the need for balanced class distribution.
Imbalanced datasets require maintaining class distribution in each fold.Step 2: Eliminate wrong options.
K-Fold does not ensure class balance (A), Time Series Split is for temporal data (C), Leave-One-Out is computationally expensive and doesn't address imbalance (D).Final Answer:
Option C -> Option CQuick Check:
Stratified keeps class balance. [OK]
Hint: Stratified keeps class balance. [OK]
Common Mistakes:
2. 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:
3. Given the following Python code snippet, what is the output?
import numpy as np
from scipy.stats import norm
confidence_level = 0.95
z_score = norm.ppf((1 + confidence_level) / 2)
print(round(z_score, 2))easy
Solution
Step 1: Calculate z-score for 95% confidence
The z-score for a 95% confidence level is calculated using the inverse of the cumulative distribution function (CDF) for a standard normal distribution.Step 2: Evaluate code output
The code correctly calculates the z-score as 1.96 for a 95% confidence interval.Final Answer:
Option C -> Option CQuick Check:
95% confidence z-score is 1.96 [OK]
Hint: 95% confidence z-score is 1.96 [OK]
Common Mistakes:
4. A decision tree model is overfitting the training data. What is the most likely cause?
medium
Solution
Step 1: Identify overfitting causes.
Overfitting often occurs when the model is too complex, such as a deep tree.Step 2: Eliminate wrong options.
A shallow tree would underfit, a small dataset affects generalization but not directly overfitting, and uninformative features would lead to poor performance, not overfitting.Final Answer:
Option D -> Option DQuick Check:
Deep trees overfit easily. [OK]
Hint: Deep trees overfit easily. [OK]
Common Mistakes:
5. When choosing between Word2Vec and BERT for a text classification task, which scenario makes Word2Vec a better choice?
medium
Solution
Step 1: Compare Word2Vec and BERT
Word2Vec is less resource-intensive and faster than BERT, which is beneficial when resources are limited.Step 2: Eliminate wrong options
Options A, C, and D require deep contextual understanding, which BERT handles better than Word2Vec.Final Answer:
Option B -> Option BQuick Check:
Word2Vec for speed, BERT for context [OK]
Hint: Word2Vec for speed, BERT for context [OK]
Common Mistakes:
