nirs4all.pipeline.dagml.folds module

Host-side CV split + fold construction for the dag-ml backend.

dag-ml has no runtime splitter, so the host owns the split: fetch the real X/y for the CV pool (identity-keyed, in request order), call the splitter, and materialize the FoldSet’s sample-int folds — including group-aware folds for repetition datasets and the exclude-aware fold variant.

class nirs4all.pipeline.dagml.folds.FoldLocalFolds(iterable=(), /)[source]

Bases: list[tuple[list[int], list[int]]]

Folds whose train lists already carry a fold-local exclusion.

build_fold_set() declares them train_exclusion: "fold_local" so DAG-ML trains each fold on its host train list instead of also removing the envelope’s (full-train) excluded samples.

nirs4all.pipeline.dagml.folds.lower_fold_file_holdout(pipeline: list[Any], spectro: Any) → tuple[list[Any], list[int] | None][source]

Turn a lone file fold into the train/test partition used by legacy.

A holdout is not cross-validation: the native full-training phase owns the fit and held-out score, while the host owns parsing the file and updating its dataset partition before a CLI adapter snapshot is taken.