Preprocessing Pipeline¶
The PreprocessingPipeline class (src/core/pipelines/preprocessing.py) turns the list of steps in your YAML file into executable Scikit-Learn transformer instances.
How It Works¶
- The
Orchestratorcallspreprocessor.build(). - It loops over every step defined in your
preprocessingYAML list. - For each step, it looks up the matching transformer class in
PreprocessingRegistry. - It instantiates the transformer with the validated parameters.
- It returns a list of
(name, transformer_instance)tuples ready to be passed to Scikit-Learn'sPipeline:
[
("rename_columns", RenameColumnsTransformer(...)),
("handle_missing", MissingValueTransformer(...)),
("encode_features", EncodingTransformer(...)),
("scale_features", ScalingTransformer(...)),
]
The Registry Mapping¶
PreprocessingRegistry connects the string type in your YAML to the Python class:
YAML type |
Transformer Class | Policy Model |
|---|---|---|
rename |
RenameColumnsTransformer |
RenamePolicy |
missing |
MissingValueTransformer |
MissingValuePolicy |
encoding |
EncodingTransformer |
EncodingPolicy |
scaling |
ScalingTransformer |
ScalingPolicy |
cleaning |
CleaningTransformer |
(dict of replacements) |
filter |
FilterTransformer |
(query condition string) |
Order of Execution¶
Steps execute in the exact order you define them in YAML. For example:
- Rename first: Standardize column names (e.g.
"Total Spend"$\to$total_spend). - Handle missing values: Impute null values with mean, median, mode, or constant.
- Encode categories: Convert string categories into numbers.
- Scale numeric features: Apply standard scaling or min-max normalization.
Column Name Dependencies
If you rename a column in step 1, remember to use the new name in subsequent steps (such as imputation, encoding, and scaling)!