nirs4all.pipeline.dagml.target_missing module
Keep target-missing samples out of training and scoring only.
A sample whose selected target is missing stays in the dataset: loading,
preview and analysis keep it unless the user asked remove_sample. A DAG-ML
training run excludes it ONLY from fitting and scoring, as DAG-ML 0.3.44
specifies for FoldSet.target_missing_sample_ids. Exclusion is the only
training behavior: DAG-ML refuses non-finite scoring targets in host results
and dag-ml-data refuses them in provider target tables, so no model can be
trained or scored on a missing target. During a run:
the host moves it out of the train/test partitions of its working dataset for the duration of the run, so no fold, CV relation, held-out test cohort or provider target table ever contains it (the splitter partitions only the target-observed samples);
every fold set of the run declares it in
target_missing_sample_ids;the captured refit model then predicts it through a native
inferencecohort, published as apredictionrow without targets or scores.
The selected targets are the target columns of the dataset being trained: a sample is target-missing when any of them is missing, because one estimator fits them together. Training a single target of a sparse multi-target dataset loads that target alone, so only the samples missing it are excluded.
- nirs4all.pipeline.dagml.target_missing.PREDICTION_PARTITION = 'prediction'
Partition label of prediction-only rows, as
save_workspace_predict_resultwrites them.
- class nirs4all.pipeline.dagml.target_missing.TargetMissingSamples(train: tuple[int, ...], test: tuple[int, ...])[source]
Bases:
objectSample ints whose selected target is missing, by original partition.
- nirs4all.pipeline.dagml.target_missing.attach_target_missing_predictions(result: Any, spectro: Any, missing: TargetMissingSamples) None[source]
Record the exclusion and predict the excluded samples with the refit model.
spectrois the dataset as it was before the run: execution may add rows (augmentation) that are not prediction inputs.The run’s exported refit model (single estimator, native aggregate such as a stack, or each independent per-source output) is replayed through a native PREDICT-only
inferencecohort, exactly asnirs4all.predictreplays an archive. Exporting persists nothing in the caller’s workspace and leaves the result’s export state unchanged. A run without an exportable refit model (refit=False, or a topology whose export is refused) records the exclusion and the reason, without predictions.
- nirs4all.pipeline.dagml.target_missing.find_target_missing(spectro: Any) TargetMissingSamples | None[source]
Return the train/test samples with a missing selected target, or
None.Multimodal IO cohorts carry their own authoritative
target_maskand are left to that contract.
- nirs4all.pipeline.dagml.target_missing.isolate_target_missing(spectro: Any, missing: TargetMissingSamples | None) Iterator[None][source]
Hold target-missing samples outside train/test while a run executes.
The working dataset keeps every sample, so wire identities do not change. The samples’ original partitions and the identity declaration are restored on exit, whatever the outcome of the run.