A classifier can look accurate while missing every positive case. In nodule-candidate classification, a model that calls everything negative scores well on a heavily negative dataset but does not find nodules. The F1 score gives precision and recall a joint place in the evaluation. section 14.0
F1 is the harmonic mean of precision and recall: 2 × precision × recall ÷ (precision + recall). It ranges from 0 to 1 when defined. Unlike an ordinary average, it cannot reward a classifier for perfect performance on one measure when the other is zero. section 14.3.4
Why not just average?
Precision 1.0 with recall 0.0 has an arithmetic average of 0.5—the same as precision 0.5 with recall 0.5. F1 gives the first pair 0 and the second 0.5, making the failure to find positives visible. section 14.3.4
Listing 14.3 Calculating F1 score
metrics_dict['pr/f1_score'] = \ 2 * (precision * recall) / (precision + recall)
The short Python listing calculates F1 from precision and recall for the training metrics. section 14.3.4
When the score is undefined
An initial training run reported 99.8% correct while identifying no positive samples. Both precision and recall were zero, so the F1 calculation divided by zero and logged nan. A high accuracy figure had hidden the failure; the new metrics exposed it. section 14.3.5
Log F1 alongside precision and recall each epoch rather than relying on a single accuracy percentage. F1 is not the only possible balance: implementing F2 and F0.5, then deciding which suits nodule classification, is a further exercise. section 14.3.4 section 14.8













