All problems
VQA Accuracy
Problem
Return the fraction of VQA predictions that match the gold answer after stripping whitespace and lowercasing.
The lists are zipped to the shorter length, and an empty gold list gives 0.0.
Hint
Normalize both sides with strip and lower before comparing.
Test cases
case 1
in: [["yes","no","blue"],["yes","yes","Blue "]]
expected: 0.6666666666666666
case 2
in: [[],[]]
expected: 0
case 3
in: [["a"],["a","b"]]
expected: 1
case 4
in: [["A "],["a"]]
expected: 1
case 5
in: [["x"],["y"]]
expected: 0
Starter codePython
def vqa_accuracy(predictions, golds):
# Your code here
pass5 test cases · run your code against them in the editor