All problems
Causal Forest Honesty Split
Problem
Return [split_count, estimate_count] for an honest causal forest split: split_count = floor(n*split_fraction) observations choose the splits and the rest estimate the leaf effects. Return [0, 0] when n is not positive or split_fraction is outside [0, 1].
Hint
Honest trees never use the same observations for splitting and estimation.
Test cases
case 1
in: [100,0.5]
expected: [50,50]
case 2
in: [101,0.5]
expected: [50,51]
case 3
in: [10,0]
expected: [0,10]
case 4
in: [10,1]
expected: [10,0]
case 5
in: [0,0.5]
expected: [0,0]
Starter codePython
def honesty_split_counts(n, split_fraction):
# Your code here
pass5 test cases · run your code against them in the editor