starplast.holdout_cv
Nested, label-locked validation for cluster-to-annotation inference.
Embeddings and clusters are unsupervised, but choosing their hyperparameters by the same labels later reported as validation is still leakage. This module separates those uses: an inner validation split chooses a structure, an untouched outer fold estimates its performance, and a cluster-to-category map is learned only from the training labels. Genes without a sufficiently supported/pure cluster abstain.
One cluster's training-only category call and its empirical support.
Learn cluster-to-category calls from training indices only; noise never receives a call.
Predict selected indices, using an explicit abstention where the training map has no call.
Macro F1 plus per-category precision/recall; abstentions count as false negatives.
Select structures on inner validation labels and score once on each untouched outer fold.
Returns (outer, per_category, validation_scores, splits). splits can be reused with
permuted labels so the null repeats the complete selection procedure on identical partitions.
Choose the structure with the best mean inner-fold score, never the outer test score.
Mean and spread of locked outer-fold category metrics.
Call unlabeled genes from the final structure, carrying cluster and locked-CV confidence.