Practice
import numpy as np
from sklearn.linear_model import LinearRegression
X_train = np.array([[1, 2], [2, 3], [3, 4]])
y_train = np.array([3, 5, 7])
model = LinearRegression().fit(X_train, y_train)
X_test = np.array([[4, 5], [5, 6]])
predictions = model.predict(X_test)
print(predictions)Solution
Step 1: Understand the impact of covariate drift.
Covariate drift affects the input distribution, leading to biased predictions.Step 2: Eliminate wrong options.
The model won't throw an error (The model will throw an error.) and predictions won't be accurate (The predictions will be accurate.) or unaffected (The predictions will be unaffected by covariate drift.) due to drift.Final Answer:
Option D -> Option DQuick Check:
Covariate drift biases predictions [OK]
Solution
Step 1: Identify the technique that modifies the loss function.
Focal Loss is designed to focus more on hard-to-classify examples by adjusting the loss function.Step 2: Eliminate wrong options.
Oversampling and undersampling adjust the dataset, not the loss function. Cost-sensitive learning modifies the cost, not the focus on hard examples.Final Answer:
Option D -> Option DQuick Check:
Focal Loss focuses on hard examples. [OK]
Solution
Step 1: Identify symptoms of vanishing gradients
Extremely small gradients often indicate the vanishing gradient problem, typically caused by certain activation functions like sigmoid or tanh.Step 2: Eliminate wrong options
The learning rate is too high. is incorrect because a high learning rate would cause divergence. The network is too shallow. is incorrect because a shallow network is less prone to vanishing gradients. The dataset is too small. is unrelated to gradient size.Final Answer:
Option C -> Option CQuick Check:
Small gradients often mean vanishing issue. [OK]
Solution
Step 1: Compare LSTM and GRU.
GRU is simpler and often faster due to fewer parameters, making it suitable for limited resources.Step 2: Eliminate wrong options.
LSTM's complexity isn't always needed, GRU isn't always more accurate, and LSTM's longer sequence handling isn't a universal advantage.Final Answer:
Option C -> Option CQuick Check:
GRU: fewer parameters, faster. [OK]
Solution
Step 1: Understand the graph dynamics
Dynamic graphs require models that can adapt to changes in nodes and edges.Step 2: Evaluate each approach
Static GCNs and fixed adjacency matrices cannot adapt to changes, and RNNs are not designed for graph structures.Final Answer:
Option A -> Option AQuick Check:
Dynamic GNNs adapt to graph changes. [check]
