Skip to content

feature: add ModelPerformanceCallback that raises ModelUnderperfomingError#875

Merged
lschilders merged 4 commits into
release/v4.0.0from
feature/model-performance-callback
May 7, 2026
Merged

feature: add ModelPerformanceCallback that raises ModelUnderperfomingError#875
lschilders merged 4 commits into
release/v4.0.0from
feature/model-performance-callback

Conversation

@lschilders
Copy link
Copy Markdown
Collaborator

This pull request introduces a new callback for evaluating model performance in forecasting workflows, ensuring that models meet defined performance criteria before proceeding. It also adds a custom exception for underperforming models and comprehensive unit tests for the new logic.

Model performance evaluation and error handling:

  • Added a new ModelPerformanceCallback class in model_performance_callback.py that checks model performance against a specified metric and threshold at the end of fitting. If the model does not meet the criteria, a ModelUnderperfomingError is raised, allowing workflows to stop early or use fallback models.
  • Introduced the ModelUnderperfomingError exception in exceptions.py, providing a descriptive error message when a model fails to meet performance requirements.

Testing:

  • Added unit tests in test_model_performance_callback.py to verify correct behavior of the callback, including scenarios where metrics are missing, metric values are above/below thresholds, and both "higher_is_better" and "lower_is_better" directions are handled.

@lschilders lschilders requested a review from a team May 7, 2026 14:17
@github-actions github-actions Bot added the feature New feature or request label May 7, 2026
egordm
egordm previously approved these changes May 7, 2026
Copy link
Copy Markdown
Collaborator

@egordm egordm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

lschilders and others added 2 commits May 7, 2026 16:19
Signed-off-by: lschilders <lars.schilders@alliander.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

@lschilders lschilders merged commit c878fea into release/v4.0.0 May 7, 2026
4 checks passed
@lschilders lschilders deleted the feature/model-performance-callback branch May 7, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants