All problems
Leakage Check
Problem
Compute the test-set leakage fraction: the share of test indices that also appear in the training indices. An empty test set returns 0.0.
Hint
Any nonzero leakage invalidates held-out evaluation claims.
Test cases
case 1
in: [[1,2,3],[4,5,6]]
expected: 0
case 2
in: [[1,2,3,4],[3,4,5,6]]
expected: 0.5
case 3
in: [[],[]]
expected: 0
Starter codePython
def dataset_leakage_fraction(train_indices, test_indices):
# Your code here
pass3 test cases · run your code against them in the editor