UXInteract / task_035 /instruction.md
DojiSum's picture
Publish the current 141-task UXInteract release
ef987bb verified
|
Raw History Blame Contribute Delete
1.35 kB

Optimize an F1 threshold

Write solve.py to choose the clarity-score threshold that maximizes binary F1 on the supplied dataset. Run python3 solve.py from the project root. Read test.csv on every run; its columns are url (identifier only), score (finite real number), and label (clear or blurry). Do not fetch images or use the network.

Threshold and output

Consider the distinct scores in the current file as candidate thresholds. At threshold t, predict clear for score >= t and blurry otherwise, so rows with tied scores receive the same prediction. Treat clear as positive. Compute F1 as 2*TP / (2*TP + FP + FN), or zero when the denominator is zero. Select any candidate achieving the maximum; scores are not restricted to [0,1].

  • Write threshold_metrics.json with finite numeric threshold and f1 fields. Keep the selected score unrounded and report its actual F1.
  • Write threshold_report.txt with clearly labeled threshold: and F1 score: values at no fewer than three decimal places, consistent with the JSON.

Acceptance Checklist

  • The threshold comes from the current scores and achieves their maximum attainable F1. The JSON and formatted report agree.
  • New score distributions, tied scores and inputs with only one class are handled without fixed thresholds, downloads or errors.