All problems
X-Learner Step
Problem
Combine X-learner imputed effects with a weight g for the control model: tau = g * d0_hat + (1 - g) * d1_hat, element-wise.
Empty input returns [].
Hint
The weight g is often the propensity score, favoring the better-estimated arm.
Test cases
case 1
in: [[1,2],[3,4],0.25]
expected: [2.5,3.5]
case 2
in: [[0,1],[2,-1],0.5]
expected: [1,0]
case 3
in: [[],[],0.5]
expected: []
Starter codePython
def x_learner_step(d0_hat, d1_hat, g):
# Your code here
pass3 test cases · run your code against them in the editor