Practice
import numpy as np
# Simulate A/B test results
A_results = np.array([1, 0, 1, 1, 0])
B_results = np.array([0, 1, 0, 0, 1])
# Calculate mean conversion rates
A_mean = np.mean(A_results)
B_mean = np.mean(B_results)
# Determine which variant is better
better_variant = 'A' if A_mean > B_mean else 'B'
print(better_variant)What does this code output?Solution
Step 1: Calculate means
A_mean = 0.6, B_mean = 0.2Step 2: Compare means
A_mean > B_mean, so 'A' is printed.Final Answer:
A -> AQuick Check:
Calculate means, compare, print. [OK]
Solution
Step 1: Consider data leakage as a common issue.
Data leakage can occur if the same data points appear in both training and validation sets.Step 2: Eliminate wrong options.
Too many folds (A) typically doesn't cause overfitting, too few folds (C) would not cause underperformance on unseen data, model complexity (D) is unrelated to cross-validation setup.Final Answer:
Option B -> Option BQuick Check:
Check for data leakage in CV. [OK]
Solution
Step 1: Identify the weak supervision challenge.
Weak supervision relies on heuristics, which can be a source of error if too simplistic.Step 2: Eliminate other causes.
Model complexity and dataset size are less likely to be the primary issue in weak supervision. Learning rate affects training stability, not heuristic quality.Final Answer:
Option A -> Option AQuick Check:
Weak supervision = heuristic quality [OK]
Solution
Step 1: Identify the key trade-off
In many business contexts, the trade-off between accuracy and interpretability is crucial because stakeholders need to understand model decisions.Step 2: Eliminate wrong options
Data volume vs. Model complexity is incorrect because data volume and model complexity are often complementary. Training time vs. Inference time is incorrect because training and inference times are usually secondary to model performance. Feature engineering vs. Hyperparameter tuning is incorrect because feature engineering and hyperparameter tuning are not directly opposing trade-offs.Final Answer:
Option C -> Option CQuick Check:
Balance accuracy with interpretability for stakeholder trust. [OK]
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]]
