Practice
1.
import numpy as np
from sklearn.preprocessing import StandardScaler
X = np.array([[1, 2], [3, 4], [5, 6]])
scaler = StandardScaler()
X_scaled = scaler.fit_transform(X)
print(X_scaled.mean(axis=0))What does this code output?easy
Solution
Step 1: Understand standardization.
StandardScaler standardizes features by removing the mean and scaling to unit variance.Step 2: Calculate the mean of standardized data.
After standardization, the mean of each feature should be 0.Final Answer:
Option C -> Option CQuick Check:
StandardScaler centers data to mean 0. [OK]
Hint: StandardScaler centers data to mean 0. [OK]
Common Mistakes:
2. In the context of framing a business problem as an ML problem, which of the following is the most crucial first step?
easy
Solution
Step 1: Identify the core requirement
The first step in framing a business problem as an ML problem is to clearly define the business objective. Without a clear objective, the ML model cannot be aligned with business goals.Step 2: Eliminate wrong options
Selecting the right algorithm is incorrect because algorithm selection comes after defining the problem. Collecting as much data as possible is incorrect because data collection should be guided by the problem definition. Ensuring high computational resources is incorrect because computational resources are a consideration after the problem is defined.Final Answer:
Option D -> Option DQuick Check:
Start with a clear business goal. [OK]
Hint: Start with a clear business goal. [OK]
Common Mistakes:
3. When choosing between a Graph Convolutional Network (GCN) and a Graph Attention Network (GAT) for a task with highly heterogeneous node importance, which is more appropriate and why?
medium
Solution
Step 1: Identify the task requirement
Highly heterogeneous node importance suggests the need for attention mechanisms.Step 2: Compare GCN and GAT
GAT uses attention to weigh node importance, unlike GCN.Final Answer:
Option B -> Option BQuick Check:
Use GAT for node importance heterogeneity. [check]
Hint: Use GAT for node importance heterogeneity. [check]
Common Mistakes:
4. When choosing between online and offline data collection for a recommendation system, which factor is most critical for deciding to use online data collection?
medium
Solution
Step 1: Identify the key factor for online data collection
Online data collection is crucial when real-time feedback is needed to update recommendations dynamically.Step 2: Eliminate factors not specific to online collection
Options B, C, and D do not specifically require online data collection; they can be addressed with offline methods.Final Answer:
Option A -> Option AQuick Check:
Real-time needs = online collection. [OK]
Hint: Real-time needs = online collection. [OK]
Common Mistakes:
5. For a large streaming dataset where you need to maintain a representative sample, which sampling strategy is most appropriate and why?
medium
Solution
Step 1: Identify the need for streaming data handling.
Streaming data requires a strategy that can update samples dynamically.Step 2: Eliminate non-streaming strategies.
Random (A) and Stratified (B) don't handle streaming efficiently. Weighted (D) is for prioritization, not streaming.Final Answer:
Option B -> Option BQuick Check:
Reservoir = Streaming data handling [[check]]
Hint: Reservoir = Streaming data handling [[check]]
Common Mistakes:
