Practice
1. In the context of continual learning, which of the following is a primary advantage over periodic retraining?
easy
Solution
Step 1: Identify the key advantage of continual learning.
Continual learning allows models to adapt immediately to new data without waiting for a retraining cycle.Step 2: Eliminate wrong options.
Reduced risk of catastrophic forgetting is incorrect because continual learning can increase the risk of catastrophic forgetting. Lower computational cost over time is incorrect because continual learning can be computationally expensive due to constant updates. Better performance on static datasets is incorrect because continual learning is not specifically better for static datasets.Final Answer:
Option D -> Option DQuick Check:
Continual learning adapts immediately. [OK]
Hint: Continual learning adapts immediately. [OK]
Common Mistakes:
2.
from sklearn.tree import DecisionTreeClassifier
import numpy as np
X = np.array([[0, 0], [1, 1], [1, 0], [0, 1]])
y = np.array([0, 1, 1, 0])
clf = DecisionTreeClassifier(criterion='gini')
clf.fit(X, y)
print(clf.predict([[0, 0], [1, 1]]))What is the output of the above code?easy
Solution
Step 1: Understand the training data.
The data is perfectly separable, and the decision tree will learn to classify based on the given labels.Step 2: Predict using the trained model.
For input [0, 0], the label is 0, and for [1, 1], the label is 1.Final Answer:
Option C -> Option CQuick Check:
Check training labels for predictions. [OK]
Hint: Check training labels for predictions. [OK]
Common Mistakes:
3. Given the following Python code for K-Means clustering, what will be the output shape of the centroids?
import numpy as np
from sklearn.cluster import KMeans
X = np.array([[1, 2], [1, 4], [1, 0], [4, 2], [4, 4], [4, 0]])
kmeans = KMeans(n_clusters=2, random_state=0).fit(X)
centroids = kmeans.cluster_centers_easy
Solution
Step 1: Analyze the code
The code uses KMeans with n_clusters=2 on a dataset with 2 features.Step 2: Determine the output shape
The centroids will have a shape of (2, 2) because there are 2 clusters and each centroid has 2 features.Final Answer:
Option C -> Option CQuick Check:
Centroids shape = (clusters, features) [OK]
Hint: Centroids shape = (clusters, features) [OK]
Common Mistakes:
4. In the context of diagnosing overfitting, which of the following is a clear indicator that a model is overfitting?
easy
Solution
Step 1: Identify overfitting symptoms
Overfitting occurs when a model learns the training data too well, including noise, leading to poor generalization on unseen data.Step 2: Eliminate wrong options
The model performs well on both training and validation datasets. indicates good generalization, The model performs poorly on both training and validation datasets. indicates underfitting, and The model's performance improves with more training data. suggests improvement, not overfitting.Final Answer:
Option B -> Option BQuick Check:
Good train, bad validation = overfitting [OK]
Hint: Good train, bad validation = overfitting [OK]
Common Mistakes:
5. A search engine's NDCG score is unexpectedly low. What is a likely cause?
medium
Solution
Step 1: Identify NDCG sensitivity
NDCG is sensitive to the position of relevant results; irrelevant results at the top lower the score.Step 2: Eliminate wrong options
Normalization affects comparability, not score; incorrect ideal DCG or log base would affect all results, not just NDCG.Final Answer:
Option D -> Option DQuick Check:
Top irrelevant results lower NDCG. [OK]
Hint: Top irrelevant results lower NDCG. [OK]
Common Mistakes:
