nirs4all.controllers.data.feature_selection module

Controller for feature selection operations (CARS, MC-UVE).

This controller handles feature selection operators, extracting wavelengths from dataset headers and managing the selection process across multiple sources and preprocessings.

class nirs4all.controllers.data.feature_selection.FeatureSelectionController[source]

Bases: OperatorController

Controller for feature selection operators (CARS, MC-UVE).

This controller: 1. Extracts wavelengths from dataset headers 2. Fits the selector on training data with target values 3. Transforms all data to keep only selected wavelengths 4. Updates dataset with new features and headers 5. Supports multi-source datasets with per-source selection

execute(step_info: ParsedStep, dataset: SpectroDataset, context: ExecutionContext, runtime_context: RuntimeContext, source: int = -1, mode: str = 'train', loaded_binaries: List[Tuple[str, Any]] | None = None, prediction_store: Any | None = None) Tuple[ExecutionContext, List][source]

Execute feature selection operation.

Parameters:
  • step_info – Pipeline step configuration

  • dataset – Dataset to operate on

  • context – Pipeline execution context

  • runtime_context – Runtime context

  • source – Data source index (-1 for all sources)

  • mode – Execution mode (“train” or “predict”)

  • loaded_binaries – Pre-loaded binary objects for prediction mode

  • prediction_store – External prediction store (unused)

Returns:

Tuple of (updated_context, fitted_selectors)

classmethod matches(step: Any, operator: Any, keyword: str) bool[source]

Match CARS and MCUVE objects.

priority: int = 5
classmethod supports_prediction_mode() bool[source]

Feature selection supports prediction mode.

classmethod use_multi_source() bool[source]

Feature selection supports multi-source datasets.