Skip to content
DeepForgeby svx
All problems
EasyNLPnlp-256

IVF Recall Estimate

Problem

Estimate IVF recall under a uniform toy model where each true neighbor is equally likely to fall in any of nlist cells. Probing nprobe cells finds a neighbor with probability nprobe / nlist.

Return min(1.0, nprobe / nlist), or 0.0 when nlist is not positive.

Hint

Clamp at 1.0 because probing more cells than exist cannot exceed perfect recall.

Test cases

case 1
in: [10,3]
expected: 0.3
case 2
in: [10,10]
expected: 1
case 3
in: [4,8]
expected: 1
case 4
in: [10,0]
expected: 0
case 5
in: [0,5]
expected: 0
Starter codePython
def ivf_recall_estimate(nlist, nprobe):
    # Your code here
    pass

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