Skip to content

Enhance Regression Metrics Module with REC Curves and AUC Calculation#126

Merged
idanmoradarthas merged 2 commits into
masterfrom
95-add-regression-error-characteristic-rec-curve-and-regression-auc
May 2, 2026
Merged

Enhance Regression Metrics Module with REC Curves and AUC Calculation#126
idanmoradarthas merged 2 commits into
masterfrom
95-add-regression-error-characteristic-rec-curve-and-regression-auc

Conversation

@idanmoradarthas

Copy link
Copy Markdown
Owner

Description

Resolves #95 by implementing the Regression Error Characteristic (REC) curve and its associated Regression Area Over the Curve (AOC) metric.

REC curves generalize the classification ROC curve to the regression domain, allowing for robust visual comparisons of continuous models. This PR implements these capabilities as a new dedicated sub-module (ds_utils.metrics.regression), keeping the architectural design consistent with the existing metrics workflows.

✨ New Features

  • regression_auc_score: Calculates the normalized Area Over the REC Curve (AOC). Returns a score in the [0, 1] range where 0.0 denotes perfect predictions (zero error).
  • plot_rec_curve_with_annotations: Visualizes REC curves for multiple regression models simultaneously using Plotly. The calculated AOC score is automatically appended to the interactive hover/legend.

📚 Documentation Updates

  • Added comprehensive Sphinx documentation (docs/source/metrics/regression.rst) containing mathematical background and theoretical context, properly referencing Bi & Bennett (2003) and Hernández-Orallo (2013).
  • Updated README.md with an end-to-end REC curve example.
  • Updated skills/metrics/SKILL.md to establish a formal "Regression Workflow" for agentic interactions.

🧪 Testing & Refactoring

  • Created tests/test_metrics/test_regression.py with 100% code coverage for all logic branches and edge cases (e.g., shape mismatches, sample weight propagation).
  • Generated robust visual regression tests utilizing pytest-mpl to guarantee visualization consistency over time.
  • Refactor: Extracted the duplicated Plotly-to-Matplotlib conversion logic (save_plotly_figure_and_return_matplot) into a shared tests/utils.py file to DRY up the testing suite.

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Refactoring (improving internal code structure without changing external behavior)
  • Documentation update

Verification

  • All new and existing unit tests pass locally (pytest).
  • Visual baseline comparisons complete successfully (--mpl).
  • The Sphinx documentation builds flawlessly without errors (make html).
  • Linter checks pass (ruff check, ruff format).

- Introduced Regression Error Characteristic (REC) curves and the associated Area Over the Curve (AOC) metric for evaluating regression models.
- Added functions `plot_rec_curve_with_annotations` and `regression_auc_score` to visualize and quantify model performance.
- Updated README.md and documentation to include new metrics and usage examples.
- Enhanced tests for regression metrics, ensuring robust validation of new functionalities.
- Bumped version to 1.10.0rc12 to reflect these additions.
@idanmoradarthas idanmoradarthas self-assigned this May 2, 2026
@idanmoradarthas idanmoradarthas linked an issue May 2, 2026 that may be closed by this pull request
12 tasks
@codecov

codecov Bot commented May 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

- Deleted the import statements for `matplotlib.pyplot` in `test_curves.py` and `test_regression.py` to clean up the code and improve clarity.
- This change helps streamline the test files by removing unnecessary dependencies, enhancing maintainability.
@idanmoradarthas
idanmoradarthas merged commit 04a773c into master May 2, 2026
13 checks passed
@idanmoradarthas
idanmoradarthas deleted the 95-add-regression-error-characteristic-rec-curve-and-regression-auc branch May 2, 2026 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Regression Error Characteristic (REC) Curve and Regression AUC

1 participant