All problems
G-Computation Mean
Problem
Return the mean of a vector of predicted outcomes, which estimates the average potential outcome under the g-computation formula. Return 0.0 for empty input.
Hint
Average the model predictions over the whole sample.
Test cases
case 1
in: [[1,2,3]]
expected: 2
case 2
in: [[0.5,0.7]]
expected: 0.6
case 3
in: [[]]
expected: 0
case 4
in: [[4]]
expected: 4
case 5
in: [[-1,1]]
expected: 0
Starter codePython
def g_computation_mean(predictions):
# Your code here
pass5 test cases · run your code against them in the editor