All problems
Uplift per Segment
Problem
Compute the absolute uplift for each segment: treatment_rate_i - control_rate_i.
Return the list of differences.
Hint
Per-segment uplift reveals where a treatment helps and where it hurts.
Test cases
case 1
in: [[0.1,0.2],[0.15,0.18]]
expected: [0.04999999999999999,-0.020000000000000018]
case 2
in: [[0.05,0.4,0.2],[0.06,0.35,0.25]]
expected: [0.009999999999999995,-0.050000000000000044,0.04999999999999999]
case 3
in: [[0.3],[0.3]]
expected: [0]
Starter codePython
def uplift_per_segment(control_rates, treatment_rates):
# Your code here
pass3 test cases · run your code against them in the editor