Skip to content
DeepForgeby svx
All problems
HardNLPnlp-180

Typo Robustness Check

Problem

Compare clean and typo robustness. Return [clean_accuracy, typo_accuracy, clean_accuracy - typo_accuracy], where each accuracy is the fraction of True entries in its list.

Return [0.0, 0.0, 0.0] when either list is empty.

Hint

Sum the boolean flags and divide by each list's own length.

Test cases

case 1
in: [[true,true,false,true],[true,false,false,false]]
expected: [0.75,0.25,0.5]
case 2
in: [[true,true],[true,true]]
expected: [1,1,0]
case 3
in: [[],[]]
expected: [0,0,0]
case 4
in: [[true],[true]]
expected: [1,1,0]
Starter codePython
def typo_robustness_check(clean_correct, typo_correct):
    # Your code here
    pass

4 test cases · run your code against them in the editor