Skip to content
DeepForgeby svx
All problems
MediumNLPnlp-216

CIDEr-lite Caption Similarity

Problem

Return the average CIDEr-lite score: for each reference, compute the cosine similarity between the candidate and reference unigram count vectors over their shared vocabulary, then average over references.

Return 0.0 when there are no references, and pairs with a zero-norm vector contribute 0.0.

Hint

Each reference is scored on its own shared vocabulary, then the scores are averaged.

Test cases

case 1
in: [["a","b","c"],[["a","b","c"]]]
expected: 1.0000000000000002
case 2
in: [["a","b"],[["a","c"]]]
expected: 0.4999999999999999
case 3
in: [["a"],[["b"],["a"]]]
expected: 0.5
case 4
in: [["a"],[]]
expected: 0
case 5
in: [[],[["a"]]]
expected: 0
Starter codePython
def cider_lite(candidate, references):
    # Your code here
    pass

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