PredictorCallback#

class openstef_models.mixins.PredictorCallback[source]#

Bases: Generic

Base callback interface for monitoring predictor workflow lifecycle events.

Provides hooks at key stages of the prediction process to enable custom functionality such as logging, metrics collection, model validation, data preprocessing, and integration with monitoring systems.

All methods have default no-op implementations, so subclasses only need to override the specific events they care about.

on_fit_start(context: WorkflowContext[TypeVar], data: I)[source]#

Called before model fitting begins.

Use this hook for pre-training validation, data preprocessing, or setting up training monitoring.

Parameters:
  • context (WorkflowContext[TypeVar]) – The workflow context performing the fitting.

  • data (TypeVar(I)) – Training dataset being used for fitting.

  • context

  • data

on_fit_end(context: WorkflowContext[TypeVar], result: FR)[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[TypeVar]) – The workflow context that completed fitting.

  • result (TypeVar(FR)) – Result of the fitting process.

  • context

  • result

on_predict_start(context: WorkflowContext[TypeVar], data: I)[source]#

Called before prediction generation begins.

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

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

  • data (TypeVar(I)) – Input dataset being used for prediction.

  • context

  • data

on_predict_end(context: WorkflowContext[TypeVar], data: I, result: PR)[source]#

Called after prediction generation completes successfully.

Use this hook for forecast validation, saving predictions, calculating metrics, or triggering downstream processes.

Parameters:
  • context (WorkflowContext[TypeVar]) – The workflow context that completed prediction.

  • data (TypeVar(I)) – Input dataset that was used for prediction.

  • result (TypeVar(PR)) – Generated prediction results.

  • context

  • data

  • result