TransformPipeline#
- class openstef_core.mixins.transform.TransformPipeline(**data: Any) None[source]
Bases:
BaseModel,Transform,GenericSequential pipeline of transformations.
Applies multiple transforms in order, fitting each transform on the intermediate outputs of the previous transforms. Ensures proper error handling and state management across the pipeline.
Invariants
Transforms are called in order, receiving the output of the previous transform.
Pipeline is considered fitted only when all transforms are fitted
Example
Creating and using a transformation pipeline
>>> from openstef_core.datasets import TimeSeriesDataset >>> # Create an empty pipeline >>> pipeline = TransformPipeline[TimeSeriesDataset](transforms=[]) >>> >>> # The pipeline can be used even when empty >>> # processed_data = pipeline.transform(data)
- Parameters:
data (
Any)
- __reduce__() tuple[Callable[[], TransformPipeline[Any]], tuple[()], Any][source]
Support pickling of generic TransformPipeline instances.
When TransformPipeline is parameterized (e.g., TransformPipeline[TimeSeriesDataset]), Python creates a dynamic type that pickle cannot find by its module path. This method provides custom pickling support by reducing to the base class and reconstructing through __setstate__.
- property is_fitted: bool
Check if all transforms in the pipeline are fitted.
- Returns:
True if all transforms are fitted, False otherwise.
- transform(data: T) T[source]
Transform data using all fitted transforms in sequence.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'protected_namespaces': (), 'ser_json_inf_nan': 'null'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].