All problems
Surrogate Fidelity
Problem
Compute surrogate fidelity: the fraction of samples where the surrogate and black-box predictions agree.
Empty input returns 0.0.
Hint
Fidelity measures how faithfully the interpretable surrogate imitates the black box.
Test cases
case 1
in: [[1,0,1,1],[1,1,1,0]]
expected: 0.5
case 2
in: [[0,0],[0,0]]
expected: 1
case 3
in: [[],[]]
expected: 0
Starter codePython
def surrogate_fidelity(blackbox_preds, surrogate_preds):
# Your code here
pass3 test cases · run your code against them in the editor