ComponentSplittingModel#
- class openstef_models.models.ComponentSplittingModel(**data: Any) None[source]#
Bases:
BaseModel,ComponentSplitterComplete component splitting pipeline combining preprocessing, splitting, and postprocessing.
Orchestrates the full component splitting workflow by managing data preprocessing, component splitting algorithms, and result postprocessing. Provides a unified interface for splitting energy time series into different components while ensuring data consistency and validation throughout the pipeline.
Invariants
fit() must be called before predict()
Component splitter and preprocessing must be compatible
Output components must sum to match input source values
Example
Basic component splitting setup:
>>> from openstef_models.models.component_splitting.constant_component_splitter import ( ... ConstantComponentSplitter, ConstantComponentSplitterConfig ... ) >>> from openstef_core.mixins import TransformPipeline >>> from openstef_core.types import EnergyComponentType >>> >>> # Create a component splitter with known energy ratios >>> splitter = ConstantComponentSplitter( ... ConstantComponentSplitterConfig( ... source_column="total_load", ... components=[EnergyComponentType.SOLAR, EnergyComponentType.WIND], ... component_ratios={ ... EnergyComponentType.SOLAR: 0.6, ... EnergyComponentType.WIND: 0.4 ... } ... ) ... ) >>> preprocessing = TransformPipeline() >>> >>> # Create and train model >>> model = ComponentSplittingModel( ... component_splitter=splitter, ... preprocessing=preprocessing, ... source_column="total_load" ... ) >>> model.fit(training_data) >>> >>> # Split components >>> components = model.predict(new_data)
- Parameters:
data (
Any)
-
preprocessing:
TransformPipeline[TimeSeriesDataset]#
-
component_splitter:
ComponentSplitter#
-
postprocessing:
TransformPipeline[EnergyComponentDataset]#
-
source_column:
str#
- property config: ComponentSplitterConfig#
Access the model’s configuration parameters.
- Returns:
Configuration object containing fundamental model parameters.
- property is_fitted: bool#
Check if the predictor has been fitted.
- fit(data: TimeSeriesDataset, data_val: TimeSeriesDataset | None = None) None[source]#
Fit the predictor to the input data.
This method should be called before generating predictions. It allows the predictor to learn parameters from the training data.
- Parameters:
data (
TimeSeriesDataset) – The training data to fit the predictor on.data_val (
TimeSeriesDataset|None) – The validation data to evaluate and tune the predictor on (optional).data
data_val
- Return type:
None
- predict(data: TimeSeriesDataset) EnergyComponentDataset[source]#
Generate predictions for the input data.
This method should use the fitted parameters to generate predictions.
- Parameters:
data (
TimeSeriesDataset) – The input data to generate predictions for.data
- Returns:
Predictions for the input data.
- Raises:
NotFittedError – If the predictor has not been fitted yet.
- Return type:
- 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].