MLFlowStorageCallback#

class openstef_models.integrations.mlflow.mlflow_storage_callback.MLFlowStorageCallback(**data: Any) None[source]

Bases: BaseConfig, ForecastingCallback

MLFlow callback for logging forecasting workflow events.

Model-agnostic: delegates to polymorphic methods on the model and fit result for child hyperparams, child data, metrics, and feature importances.

Parameters:

data (Any)

storage: MLFlowStorage
model_reuse_enable: bool
model_reuse_max_age: timedelta
model_selection_enable: bool
model_selection_metric: tuple[Union[Quantile, Literal['global']], str, TypeAliasType]
model_selection_old_model_penalty: float
store_feature_importance_plot: 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.

Parameters:

context (Any)

Return type:

None

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:

None

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:

None

on_predict_start(context: WorkflowContext[CustomForecastingWorkflow], data: VersionedTimeSeriesDataset | TimeSeriesDataset)[source]

Called before prediction generation begins.

Use this hook for input data validation, prediction setup, or logging prediction requests.

Parameters:
  • context (WorkflowContext[CustomForecastingWorkflow]) – The workflow context performing the prediction.

  • data (VersionedTimeSeriesDataset | TimeSeriesDataset) – Input dataset being used for prediction.

  • context

  • data

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].