coco_pipe.decoding.targets#

Target-label resolution and grouped-cross-validation fold helpers.

Functions#

prepare_target(container, target_spec[, group_col])

Resolve labels and leakage-safe groups from a ~coco_pipe.io.DataContainer.

safe_group_n_splits(y, groups[, requested, stratified])

Return the largest viable grouped fold count.

Module Contents#

coco_pipe.decoding.targets.prepare_target(container, target_spec, group_col='patient_group_id')#

Resolve labels and leakage-safe groups from a ~coco_pipe.io.DataContainer.

Binary targets require an explicit positive_class. This prevents alphabetical class ordering from silently changing ROC-AUC, precision, recall, and F1 semantics.

Parameters:
Return type:

tuple[coco_pipe.io.DataContainer, numpy.ndarray, numpy.ndarray, pandas.DataFrame]

coco_pipe.decoding.targets.safe_group_n_splits(y, groups, requested=5, stratified=True)#

Return the largest viable grouped fold count.

Parameters:
Return type:

int