Training pipeline
fyt.core.training_pipeline
¶
Training pipeline orchestrator.
Sequences all pipeline stages using protocol-based dependencies, enabling component substitution without modifying this module.
TrainingPipeline
¶
Complete training pipeline orchestrating all components.
This class integrates data management, preprocessing, feature selection, and model training into a unified pipeline with dependency injection.
All component dependencies are declared as protocols, allowing any conforming implementation to be substituted.
experiment_reporter
property
¶
The experiment reporter instance.
model
property
¶
The trained model from the trainer.
Returns:
| Type | Description |
|---|---|
|
The trained model instance. |
__init__(config, data_manager, pre_processor, target_processor, feature_selector, trainer, metrics_evaluator, hyperparameter_optimizer=None, experiment_reporter=None, task=TaskType.CLASSIFICATION)
¶
Initialize the TrainingPipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
TrainerPipelineConfig
|
Configuration for the entire training pipeline. |
required |
data_manager
|
DataSplitter
|
Data loader and splitter. |
required |
pre_processor
|
Preprocessor
|
Feature preprocessor. |
required |
target_processor
|
TargetTransformer
|
Target variable encoder. |
required |
feature_selector
|
FeatureFilter
|
Feature selection strategy. |
required |
trainer
|
Predictor
|
Model trainer and predictor. |
required |
metrics_evaluator
|
MetricsEvaluator
|
Metrics computation. |
required |
hyperparameter_optimizer
|
HyperparameterOptimizer | None
|
Optional hyperparameter optimizer. |
None
|
experiment_reporter
|
ExperimentReporter | None
|
Optional experiment reporter for logging results. |
None
|
task
|
TaskType
|
Learning task type. |
CLASSIFICATION
|
get_class_mapping()
¶
Get the class mapping from the target processor.
Returns:
| Type | Description |
|---|---|
dict[str, int] | None
|
Dictionary mapping class labels to integers or None if not fitted yet. |
get_selected_features()
¶
Get the list of features selected by the feature selector.
Returns:
| Type | Description |
|---|---|
list[str] | None
|
List of selected feature names or None if not fitted yet. |
run(test_size=0.2, random_state=42)
¶
Run the complete training pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
test_size
|
float
|
Proportion of data to use for testing. |
0.2
|
random_state
|
int
|
Random seed for reproducibility. |
42
|
Returns:
| Type | Description |
|---|---|
MetricResults
|
MetricResults containing all evaluation metrics. |
to_inference_pipeline()
¶
Bundle the fitted components into a persistable InferencePipeline.
Returns:
| Type | Description |
|---|---|
|
An InferencePipeline wrapping the fitted preprocessor, feature |
|
|
selector, target processor, and trained model. |