All problems
Uplift Calibration Error
Problem
Compute the count-weighted calibration error of uplift predictions: sum over bins of (count/total) * |predicted - observed|.
Return 0.0 when the total count is 0.
Hint
Calibration checks whether predicted uplift magnitude matches reality.
Test cases
case 1
in: [[0.1,0.2],[0.05,0.3],[100,50]]
expected: 0.06666666666666665
case 2
in: [[0.2],[0.2],[10]]
expected: 0
case 3
in: [[],[],[]]
expected: 0
Starter codePython
def uplift_calibration_error(predicted_uplift, observed_uplift, counts):
# Your code here
pass3 test cases · run your code against them in the editor