nirs4all.controllers.models.stacking.config module

Configuration classes for training set reconstruction.

This module provides configuration dataclasses used by the TrainingSetReconstructor for controlling how out-of-fold predictions are collected and processed.

class nirs4all.controllers.models.stacking.config.ReconstructorConfig(validate_fold_alignment: bool = True, validate_sample_coverage: bool = True, log_warnings: bool = True, max_missing_fold_ratio: float = 0.0, allow_partial_sources: bool = False, feature_name_pattern: str = '{model_name}_pred', excluded_fold_ids: Set[str] = <factory>)[source]

Bases: object

Configuration for TrainingSetReconstructor.

Controls internal behavior of the reconstruction process, separate from the user-facing StackingConfig.

validate_fold_alignment

Whether to validate fold structure consistency.

Type:

bool

validate_sample_coverage

Whether to validate sample coverage.

Type:

bool

log_warnings

Whether to log warnings during reconstruction.

Type:

bool

max_missing_fold_ratio

Maximum ratio of missing folds before error (0.0-1.0).

Type:

float

allow_partial_sources

Allow reconstruction if some sources have partial data.

Type:

bool

feature_name_pattern

Pattern for generating feature column names. Supports: {model_name}, {fold_id}, {classname}, {step_idx}

Type:

str

excluded_fold_ids

Set of fold_id values to exclude (e.g., {‘avg’, ‘w_avg’}).

Type:

Set[str]

Example

>>> config = ReconstructorConfig(
...     validate_fold_alignment=True,
...     log_warnings=True,
...     feature_name_pattern="{model_name}_pred"
... )
__post_init__()[source]

Validate configuration after initialization.

allow_partial_sources: bool = False
excluded_fold_ids: Set[str]
feature_name_pattern: str = '{model_name}_pred'
log_warnings: bool = True
max_missing_fold_ratio: float = 0.0
validate_fold_alignment: bool = True
validate_sample_coverage: bool = True