Skip to content
DeepForgeby svx
All problems
EasyML Fundamentalsml-182

Relative Uplift

Problem

Compute the relative uplift in percent: (treatment_rate - control_rate) / control_rate * 100.

Return 0.0 when the control rate is 0.

Hint

Relative uplift normalizes the absolute difference by the control baseline.

Test cases

case 1
in: [0.1,0.12]
expected: 19.99999999999999
case 2
in: [0.2,0.15]
expected: -25.000000000000007
case 3
in: [0,0.05]
expected: 0
case 4
in: [0.4,0.4]
expected: 0
Starter codePython
def relative_uplift(control_rate, treatment_rate):
    # Your code here
    pass

4 test cases · run your code against them in the editor