nirs4all.pipeline.steps.parser module
Step parser for pipeline step configurations.
- class nirs4all.pipeline.steps.parser.ParsedStep(operator: Any, keyword: str, step_type: StepType, original_step: Any, metadata: Dict[str, Any], force_layout: str | None = None)[source]
Bases:
objectNormalized step configuration after parsing.
- operator
Deserialized operator instance (or None for workflow ops)
- Type:
Any
- step_type
Type of step (workflow, serialized, etc.)
- original_step
Original step configuration
- Type:
Any
- class nirs4all.pipeline.steps.parser.StepParser[source]
Bases:
objectParses pipeline step configurations into normalized format.
Handles multiple step syntaxes: - Dictionary: {“model”: SVC, “params”: {…}} - String: “sklearn.preprocessing.StandardScaler” - Direct instance: StandardScaler() - Nested lists: [[step1, step2], step3]
Normalizes to canonical ParsedStep format for controller execution.
- RESERVED_KEYWORDS = ['params', 'metadata', 'steps', 'name', 'finetune_params', 'train_params', 'fit_on_all', 'force_layout']
- SERIALIZATION_OPERATORS = ['class', 'function', 'module', 'object', 'pipeline', 'instance']
- VALID_LAYOUTS = {'2d', '2d_interleaved', '3d', '3d_transpose'}
- WORKFLOW_KEYWORDS = ['model', 'preprocessing', 'feature_augmentation', 'auto_transfer_preproc', 'concat_transform', 'y_processing', 'sample_augmentation', 'branch']
- parse(step: Any) ParsedStep[source]
Parse a pipeline step into normalized format.
- Parameters:
step – Raw step configuration
- Returns:
ParsedStep with normalized operator and metadata
- Raises:
ValueError – If step format is invalid