Precision, recall, and threshold tradeoffs — step 7 of 7
Checkpoint
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Checkpoint. See the tradeoff with your own code. Each case has a fraud
score and the actual label. Write recall_at(cases, threshold)
that flags every case with score >= threshold, then returns recall =
(real fraud flagged) / (all real fraud).
Print recall at threshold 0.5 and at 0.8 in this exact format:
[email protected]=1.00 [email protected]=0.67
(Raising the threshold catches less fraud — recall drops.)