Reddit-inspired moderation model produces continuous risk scores while the operations team needs a binary decision threshold. You need to evaluate candidate thresholds and select the one that maximizes Youden’s J statistic.
Choose the decision threshold that maximises Youden's J=TPR−FPR. Candidate thresholds are the distinct scores; an example is predicted positive when score >= threshold. Labels y are 0/1, and if several thresholds give the same J the smallest one is returned.
Implement solve(y,scores).
Returns. Return the chosen threshold (one of the scores) as a float. A rate whose denominator is zero (no positives or no negatives) counts as 0.
Implement solve(y, scores).
Example 1
Input:
solve([1, 1, 0, 0], [0.9, 0.7, 0.6, 0.2])
Output:
0.7
Example 2
Input:
solve([0, 0, 1, 1], [0.1, 0.4, 0.35, 0.8])
Output:
0.35
No results yet
Run your code to check it against the examples, or submit to run every test.