Skip to content
DeepForgeby svx
All problems
MediumComputer Visioncv-367

IDF1 Lite

Problem

Compute a simplified IDF1 identity score.

IDF1 = 2 * idtp / (2 * idtp + idfp + idfn), where idtp counts correctly matched identity detections, and idfp / idfn are identity false positives and negatives. Return the value rounded to 4 decimal places, or 0.0 when the denominator is 0.

Hint

IDF1 is the harmonic mean of identity precision and recall.

Test cases

case 1
in: [8,1,1]
expected: 0.8889
case 2
in: [0,0,0]
expected: 0
case 3
in: [5,0,0]
expected: 1
case 4
in: [3,2,4]
expected: 0.5
Starter codePython
def idf1(idtp, idfp, idfn):
    # Your code here
    pass

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