Cross-Validation

Cross-validation estimates performance by repeatedly splitting data into train and validation folds. It is useful when data is limited, but it does not replace a final held-out test set for a publication-quality claim.

In -fold cross-validation, the data is partitioned into folds . The model is trained on all but one fold and evaluated on the held-out fold:

where is trained without fold .

Key Ideas

  • Cross-validation reduces dependence on one arbitrary validation split.
  • It can still leak if near-duplicates, scaffolds, protein families, time, or assay batches cross folds.
  • Hyperparameter tuning inside cross-validation requires nesting or a separate final test set.
  • For grouped data, folds should be grouped by the entity that defines generalization.

Fold Unit

The fold assignment function should be written explicitly:

where is the example unit and maps examples to folds. If the claim is scaffold generalization, should depend on scaffold. If the claim is protein-family generalization, should depend on family or sequence identity group.

ClaimFold Unit
IID interpolationrandom or stratified example
chemical generalizationscaffold, series, time, or molecule identity group
protein generalizationfamily, target, sequence identity cluster
complex generalizationpaired ligand and protein grouping
assay/source robustnessassay, source, lab, batch, endpoint group
temporal deploymenttime-based fold or final time holdout

Nested Selection

If hyperparameters are tuned inside cross-validation, use nested CV:

where is selected using only the training portion of outer fold . Reusing the outer validation fold for both selection and final reporting overestimates performance.

Practical Checks

  • Are folds random, stratified, scaffold-based, family-based, temporal, or grouped?
  • Is preprocessing fitted only on the training portion of each fold?
  • Are hyperparameters selected without peeking at test data?
  • Is a final untouched test set reserved for the main claim?
  • Are near-duplicates, scaffolds, homologs, assays, or time groups kept within the same fold?
  • Is the reported uncertainty across folds, seeds, or examples?