Practice
1. In the context of Convolutional Neural Networks, what is the primary purpose of pooling layers?
easy
Solution
Step 1: Understand pooling layers
Pooling layers are used to reduce the spatial dimensions of feature maps, which helps in reducing computation and controlling overfitting.Step 2: Eliminate wrong options
To increase the size of the feature maps is incorrect because pooling reduces size, not increases it. To increase the number of channels in the feature maps is incorrect as pooling doesn't change the number of channels. To apply non-linear activation functions is incorrect because pooling doesn't apply non-linear activations.Final Answer:
Option A -> Option AQuick Check:
Pooling reduces spatial dimensions. [OK]
Hint: Pooling reduces spatial dimensions. [OK]
Common Mistakes:
2. Given the following Python code snippet, what will be the output?
import numpy as np
business_goals = np.array(['increase sales', 'reduce churn', 'improve satisfaction'])
ml_problems = np.array(['classification', 'regression', 'clustering'])
result = np.char.add(business_goals, ml_problems)
print(result)easy
Solution
Step 1: Understand the operation
The np.char.add function concatenates corresponding elements of two arrays element-wise.Step 2: Eliminate wrong options
['increase sales', 'reduce churn', 'improve satisfaction'] and C are incorrect because they ignore the concatenation operation. Throws an error due to incompatible types is incorrect because np.char.add handles string arrays correctly.Final Answer:
Option A -> Option AQuick Check:
np.char.add concatenates strings element-wise. [OK]
Hint: np.char.add concatenates strings element-wise. [OK]
Common Mistakes:
3. Given the following Python code using Naive Bayes, what will be the output?
from sklearn.naive_bayes import GaussianNB
import numpy as np
X = np.array([[1, 2], [2, 3], [3, 4]])
y = np.array([1, 0, 1])
model = GaussianNB()
model.fit(X, y)
print(model.predict([[2, 2]]))easy
Solution
Step 1: Understand the Code Execution
The code fits a Gaussian Naive Bayes model and predicts the class for a new sample [2, 2].Step 2: Analyze the Prediction
Given the training data, the model predicts class 1 for [2, 2] based on the likelihoods.Final Answer:
Option A -> Option AQuick Check:
GaussianNB predicts based on likelihoods. [[check]]
Hint: GaussianNB predicts based on likelihoods. [[check]]
Common Mistakes:
4. How would you adapt K-Fold cross-validation for a dataset with a temporal component and class imbalance?
hard
Solution
Step 1: Address both temporal order and class imbalance.
Time Series Split respects temporal order, and manual balancing addresses class imbalance.Step 2: Eliminate wrong options.
Standard K-Fold (A) ignores temporal order, Stratified K-Fold (B) doesn't respect temporal order, Leave-One-Out (D) is computationally expensive and doesn't address temporal order.Final Answer:
Option D -> Option DQuick Check:
Time series + imbalance = manual balance. [OK]
Hint: Time series + imbalance = manual balance. [OK]
Common Mistakes:
5. You are tasked with adapting a Transformer model for a real-time translation application on mobile devices. Which approach is most suitable?
hard
Solution
Step 1: Consider constraints
Real-time applications on mobile devices require efficient models with low latency and small size.Step 2: Eliminate wrong options
Use a larger model with more layers for better accuracy is incorrect because larger models increase latency. Increase the number of attention heads for better context understanding is incorrect because more heads increase complexity. Use a higher learning rate to speed up training is incorrect because learning rate affects training, not inference.Final Answer:
Option B -> Option BQuick Check:
Mobile apps need efficient, small models. [OK]
Hint: Mobile apps need efficient, small models. [OK]
Common Mistakes:
