nirs4all.pipeline.execution.preprocessing module

Fold-local fitting and replay of learned legacy feature preprocessing.

class nirs4all.pipeline.execution.preprocessing.FoldPreprocessedModel(model: Any, preprocessing: PreprocessingReplay)[source]

Bases: object

Persist a model together with its fold’s fitted preprocessing.

model: Any
predict(X: ndarray, **kwargs: Any) → Any[source]
predict_proba(X: ndarray, **kwargs: Any) → Any[source]
preprocessing: PreprocessingReplay
class nirs4all.pipeline.execution.preprocessing.FoldPreprocessing(dataset: SpectroDataset, replay: PreprocessingReplay, active: bool = False, unsupported_reason: str | None = None)[source]

Bases: object

Keep raw features and stage specifications until a fold is fitted.

active: bool = False
classmethod capture(dataset: SpectroDataset, context: ExecutionContext) → FoldPreprocessing[source]
dataset: SpectroDataset
prepare_fold(dataset: SpectroDataset, model_context: ExecutionContext, train_ids: Any) → PreprocessingReplay[source]
raw_features(ids: Any, layout: str = '2d') → ndarray[source]
replay: PreprocessingReplay
unsupported_reason: str | None = None
nirs4all.pipeline.execution.preprocessing.feature_step(step: Any) → tuple[bool, bool][source]

Identify feature stages and target-dependent stages, including containers.

nirs4all.pipeline.execution.preprocessing.observe_feature_step(step: Any, dataset: SpectroDataset, context: ExecutionContext, runtime: Any) → bool[source]

Capture stages even inside branches; return whether replay owns this stage.