0
0
ML Pythonml~20 mins

A/B testing models in ML Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
A/B Testing Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Purpose of A/B Testing in Machine Learning
What is the main goal of performing A/B testing when comparing two machine learning models?
ATo determine which model performs better on a specific metric using real user data
BTo combine the predictions of both models to improve accuracy
CTo train both models on the same dataset simultaneously
DTo reduce the size of the training dataset by splitting it
Attempts:
2 left
💡 Hint
Think about how A/B testing helps in decision making with live data.
Predict Output
intermediate
2:00remaining
Output of A/B Test Metric Calculation
Given the following Python code that calculates conversion rates for two models in an A/B test, what is the printed output?
ML Python
model_a_conversions = 120
model_a_visitors = 1000
model_b_conversions = 150
model_b_visitors = 1200

conversion_rate_a = model_a_conversions / model_a_visitors
conversion_rate_b = model_b_conversions / model_b_visitors

print(f"Model A Conversion Rate: {conversion_rate_a:.3f}")
print(f"Model B Conversion Rate: {conversion_rate_b:.3f}")
A
Model A Conversion Rate: 0.120
Model B Conversion Rate: 0.125
B
Model A Conversion Rate: 0.125
Model B Conversion Rate: 0.120
C
Model A Conversion Rate: 0.012
Model B Conversion Rate: 0.015
D
Model A Conversion Rate: 1.200
Model B Conversion Rate: 1.250
Attempts:
2 left
💡 Hint
Conversion rate is conversions divided by visitors.
Hyperparameter
advanced
2:00remaining
Choosing Sample Size for A/B Testing
Which factor is most important when deciding the sample size for an A/B test comparing two machine learning models?
AThe number of layers in the neural network
BThe number of features in the dataset
CThe expected difference in performance between the two models
DThe training time of the models
Attempts:
2 left
💡 Hint
Think about what affects the ability to detect a difference in results.
Metrics
advanced
2:00remaining
Interpreting A/B Test Results with Confidence Intervals
If the 95% confidence interval for the difference in conversion rates between Model B and Model A is [-0.01, 0.03], what can you conclude?
AModel B is significantly better than Model A
BThere is no statistically significant difference between the models
CModel A is significantly better than Model B
DThe test was invalid due to overlapping intervals
Attempts:
2 left
💡 Hint
Check if zero is inside the confidence interval.
🔧 Debug
expert
3:00remaining
Identifying the Bug in A/B Test Data Split Code
What error will this Python code raise when splitting data for an A/B test, and why? code: import numpy as np users = np.array([1,2,3,4,5,6,7,8,9,10]) np.random.seed(42) mask = np.random.rand(len(users)) > 0.5 ab_test_group = users[mask] control_group = users[~mask] print(f"A/B Test Group: {ab_test_group}") print(f"Control Group: {control_group}") print(f"Total users: {len(ab_test_group) + len(control_group)}")
AIndexError because mask contains values outside valid index range
BTypeError because mask is not a boolean array
CValueError because the mask length does not match users length
DNo error; the total users printed will be 10
Attempts:
2 left
💡 Hint
Check the type and length of the mask array.