nirs4all.pipeline.execution.refit.config_extractor module

Winning configuration extraction for the refit phase.

After cross-validation (Pass 1) completes, this module extracts the winning pipeline configuration – the expanded steps, finetuned params, and generator choices – so that the refit phase can replay the exact configuration that produced the best CV score.

Also provides per-model configuration extraction for refitting ALL unique model classes independently, and multi-criteria top-K selection.

class nirs4all.pipeline.execution.refit.config_extractor.RefitCriterion(top_k: int = 1, ranking: str = 'rmsecv', metric: str = '', selection_level: str | None = None, refit_mode: str = 'refit_one', reduction_plan: Any | None = None)[source]

Bases: object

A single refit selection criterion.

Variables:
  • top_k (int) – Number of top pipeline variants to select.

  • ranking (str) – Ranking method. "rmsecv" uses the avg fold’s validation score (RMSECV from concatenated OOF predictions). "mean_val" uses the arithmetic mean of individual fold validation scores.

  • metric (str) – Metric name for ranking. Empty string uses the metric recorded in the pipeline records.

  • selection_level (str | None) – Reserved hook (roadmap N0) for the future evaluation scope at which this criterion selects ("row" / "observation" / "combo" / "sample"). None keeps the legacy behaviour and is inert in this phase.

metric: str = ''
ranking: str = 'rmsecv'
reduction_plan: Any | None = None
refit_mode: str = 'refit_one'
selection_level: str | None = None
top_k: int = 1
class nirs4all.pipeline.execution.refit.config_extractor.RefitSlotPlan(refit_mode: str = 'refit_one', selection_level: str | None = None, selection_metric: str = '', reduction_plan: Any | None = None)[source]

Bases: object

Selection/refit slot contract for one refit replay.

reduction_plan: Any | None = None
refit_mode: str = 'refit_one'
selection_level: str | None = None
selection_metric: str = ''
to_dict() → dict[str, Any][source]

Return a manifest-safe mapping.