PythiloLesson 4 of 12 · progress kept in this browser

Threshold Sweep

One score can produce different decisions. Compare F1 at candidate thresholds on validation labels; break equal scores toward the smaller threshold.

scores = [0.2, 0.6, 0.9]
print([int(score >= 0.5) for score in scores])
Your task

choose_threshold(scores, labels, candidates) returns the candidate with greatest binary F1, choosing the smallest on a tie. A score >= threshold predicts 1; candidates is nonempty.