DataSaveCallback#
- class openstef_models.workflows.callbacks.DataSaveCallback(**data: Any) None[source]
Bases:
BaseConfig,ForecastingCallbackSaves intermediate datasets to parquet files during workflow execution.
Toggle individual outputs via the boolean fields. All paths use
workflow.run_nameas an identifier in the filename.- Parameters:
data (
Any)
-
cache_dir:
Path
-
save_training_data:
bool
-
save_prepared_data:
bool
-
save_predict_data:
bool
-
save_forecast:
bool
-
save_contributions:
bool
- model_post_init(context: Any) None[source]
Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.
- on_fit_start(context: WorkflowContext[CustomForecastingWorkflow], data: VersionedTimeSeriesDataset | TimeSeriesDataset) None[source]
Called before model fitting begins.
Use this hook for pre-training validation, data preprocessing, or setting up training monitoring.
- Parameters:
context (
WorkflowContext[CustomForecastingWorkflow]) – The workflow context performing the fitting.data (
VersionedTimeSeriesDataset|TimeSeriesDataset) – Training dataset being used for fitting.context
data
- Return type:
- on_fit_end(context: WorkflowContext[CustomForecastingWorkflow], result: ModelFitResult) None[source]
Called after model fitting completes successfully.
Use this hook for post-training validation, model evaluation, saving training metrics, or triggering downstream processes.
- Parameters:
context (
WorkflowContext[CustomForecastingWorkflow]) – The workflow context that completed fitting.result (
ModelFitResult) – Result of the fitting process.context
result
- Return type:
- on_predict_end(context: WorkflowContext[CustomForecastingWorkflow], data: VersionedTimeSeriesDataset | TimeSeriesDataset, result: ForecastDataset) None[source]
Called after prediction generation completes successfully.
Use this hook for forecast validation, saving predictions, calculating metrics, or triggering downstream processes.
- Parameters:
context (
WorkflowContext[CustomForecastingWorkflow]) – The workflow context that completed prediction.data (
VersionedTimeSeriesDataset|TimeSeriesDataset) – Input dataset that was used for prediction.result (
ForecastDataset) – Generated prediction results.context
data
result
- Return type:
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': False, 'extra': 'ignore', 'protected_namespaces': ()}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].