Practice
1. In which scenario is supervised learning most appropriate?
easy
Solution
Step 1: Identify the scenario.
Supervised learning is used when labeled data is available and the goal is to predict outcomes.Step 2: Eliminate wrong options.
When you want to cluster similar data points without labels. describes unsupervised learning (clustering), When you need to explore an environment to maximize rewards. describes reinforcement learning (exploration and rewards), and When you want to reduce dimensionality of data without labels. describes unsupervised learning (dimensionality reduction).Final Answer:
Option B -> Option BQuick Check:
Labeled data -> Supervised learning [OK]
Hint: Labeled data -> Supervised learning [OK]
Common Mistakes:
2.
import numpy as np
from sklearn.model_selection import cross_val_score
from sklearn.tree import DecisionTreeClassifier
X = np.array([[1, 2], [3, 4], [5, 6], [7, 8]])
y = np.array([0, 1, 0, 1])
model = DecisionTreeClassifier()
scores = cross_val_score(model, X, y, cv=2)
print(scores)What does this code output?easy
Solution
Step 1: Understand cross-validation output
Cross-validation with cv=2 splits the data into two folds, returning an array of two scores.Step 2: Eliminate wrong options
An error because the dataset is too small for cross-validation. is incorrect because the code runs without error. A single accuracy score for the entire dataset. is incorrect because cross-validation returns multiple scores. An array of four accuracy scores, one for each data point. is incorrect because the number of scores equals the number of folds, not data points.Final Answer:
Option A -> Option AQuick Check:
Cross-validation returns scores per fold. [OK]
Hint: Cross-validation returns scores per fold. [OK]
Common Mistakes:
3. When deciding between MLflow and Weights & Biases for experiment tracking, which scenario makes MLflow a better choice?
medium
Solution
Step 1: Compare MLflow and W&B features
MLflow is often chosen for self-hosting due to its open-source nature.Step 2: Match features to scenarios
MLflow's self-hosting is ideal for environments with strict data privacy requirements.Final Answer:
Option C -> Option CQuick Check:
MLflow = Self-hosting [OK]
Hint: MLflow = Self-hosting [OK]
Common Mistakes:
4. When framing a business problem as an ML problem, which trade-off is most critical to consider?
medium
Solution
Step 1: Identify the key trade-off
In many business contexts, the trade-off between accuracy and interpretability is crucial because stakeholders need to understand model decisions.Step 2: Eliminate wrong options
Data volume vs. Model complexity is incorrect because data volume and model complexity are often complementary. Training time vs. Inference time is incorrect because training and inference times are usually secondary to model performance. Feature engineering vs. Hyperparameter tuning is incorrect because feature engineering and hyperparameter tuning are not directly opposing trade-offs.Final Answer:
Option C -> Option CQuick Check:
Balance accuracy with interpretability for stakeholder trust. [OK]
Hint: Balance accuracy with interpretability for stakeholder trust. [OK]
Common Mistakes:
5. In a recommendation system, how would you apply feature engineering to improve the model's ability to capture user-item interactions?
hard
Solution
Step 1: Identify the need for capturing interactions.
Recommendation systems benefit from understanding user-item interactions.Step 2: Evaluate feature engineering techniques.
Collaborative filtering (A) is a model, not feature engineering. One-hot encoding (B) doesn't capture interactions. Normalizing (D) doesn't enhance interaction capture. Interaction terms (C) explicitly model user-item interactions, improving the system's ability to recommend.Final Answer:
Option A -> Option AQuick Check:
Interaction terms enhance user-item interaction capture. [OK]
Hint: Interaction terms enhance user-item interaction capture. [OK]
Common Mistakes:
