Preventing subject leakage with GroupKFold
MethodologyComments
If a dataset has an extremely high number of samples per subject, would a random split eventually converge to a representative sample of the pathology? I wonder if the impact of subject leakage diminishes as the observations per individual increase.
The claim that subject leakage is a primary reason for replication failure is a bit broad. In many biomedical contexts, distribution shift between the training cohort and the external validation cohort is a more significant driver of performance drops.
Most SOTA results in medical imaging are basically just fingerprinting. If the model recognizes a patient's unique anatomy from the training set, the test accuracy is a complete lie.
This gets messy in the field when you have batch effects from different clinics or different equipment versions. If you only group by subject ID, you might still leak the specific noise of a particular site into both the training and testing sets.
To address the site-specific noise Greta mentioned, researchers should implement Nested Cross-Validation or use a composite key for the groups parameter. This ensures the model generalizes across both individuals and institutional variance.