Practice
1. 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:
2.
import numpy as np
y_true = np.array([3, -0.5, 2, 7])
y_pred = np.array([2.5, 0.0, 2, 8])
mae = np.mean(np.abs(y_true - y_pred))
print(mae)What is the output of this code snippet?easy
Solution
Step 1: Calculate the absolute errors.
Errors are [0.5, 0.5, 0, 1].Step 2: Compute the mean of absolute errors.
Mean is (0.5 + 0.5 + 0 + 1) / 4 = 0.625.Final Answer:
Option A -> Option AQuick Check:
Sum errors, divide by count. [OK]
Hint: Sum absolute errors, divide by count. [OK]
Common Mistakes:
3. In the context of high-dimensional data, which of the following is a primary reason why the curse of dimensionality affects nearest neighbor algorithms?
easy
Solution
Step 1: Understand the curse of dimensionality.
In high dimensions, the distance between points becomes less informative.Step 2: Eliminate wrong options.
High-dimensional data increases the risk of overfitting. is about overfitting, not distance. High-dimensional data requires more computational resources. is about computation, not distance. High-dimensional data leads to more complex decision boundaries. is about decision boundaries, not distance.Final Answer:
Option A -> Option AQuick Check:
High dimensions dilute distance meaning. [OK]
Hint: High dimensions dilute distance meaning. [OK]
Common Mistakes:
4. 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:
5. You are tasked with designing a model for a real-time translation app. Which architecture would you choose and why?
hard
Solution
Step 1: Consider the requirements of real-time translation.
Real-time translation requires handling long-range dependencies efficiently.Step 2: Evaluate each architecture.
Use a standard RNN for its simplicity and ease of implementation. is incorrect as RNNs are slow for long sequences. Use a CNN-based model for its speed in processing sequences. is incorrect because CNNs struggle with sequence dependencies. Use a hybrid RNN-CNN model to leverage both sequence processing and speed. is incorrect as hybrid models add complexity without solving dependency issues.Final Answer:
Option D -> Option DQuick Check:
Transformers excel in long-range dependencies. [OK]
Hint: Transformers excel in long-range dependencies. [OK]
Common Mistakes:
