Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Comments

API: do not compute performance metrics, return arrays for users #32

Merged
martinfleis merged 5 commits intomainfrom
metrics-are-user-responsibility
Dec 15, 2025
Merged

API: do not compute performance metrics, return arrays for users #32
martinfleis merged 5 commits intomainfrom
metrics-are-user-responsibility

Conversation

@martinfleis
Copy link
Member

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors the API to remove automatic computation of performance metrics and instead return raw arrays for users to compute their own metrics. The change shifts responsibility from the library to the user, providing more flexibility and reducing computational overhead when metrics aren't needed.

Key Changes:

  • Removed the measure_performance parameter from all model classes
  • Replaced computed metric attributes (e.g., focal_score_, pooled_score_, local_score_) with raw data arrays (e.g., y_pooled_, pred_pooled_, left_out_y_, left_out_proba_)
  • Added new local_metric() method to BaseClassifier for computing custom local performance metrics
  • Updated BandwidthSearch to handle metrics differently, computing only required metrics on-demand

Reviewed changes

Copilot reviewed 9 out of 12 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
gwlearn/base.py Removed measure_performance parameter and automatic metric computation from base classes; added local_metric() method for custom metric computation; replaced computed metrics with raw prediction/target arrays
gwlearn/linear_model.py Removed measure_performance from GWLogisticRegression and GWLinearRegression; replaced computed pooled/local metrics with raw y_pooled_ and pred_pooled_ arrays; updated docstrings to reflect new attributes
gwlearn/ensemble.py Removed measure_performance from ensemble classifiers; replaced OOB metric computations with raw oob_y_pooled_ and oob_pred_pooled_ arrays
gwlearn/search.py Updated to compute metrics on-demand rather than relying on model's measure_performance; added special handling for log_loss calculation
gwlearn/tests/test_base.py Removed tests for automatic metric computation; updated assertions to check raw prediction arrays instead of computed metrics
gwlearn/tests/test_linear_model.py Removed tests for pooled and local performance metrics that are no longer computed automatically
gwlearn/tests/test_ensemble.py Removed tests for OOB metric attributes; updated to verify raw OOB data arrays instead
gwlearn/tests/test_search.py Simplified metric tracking tests to focus on prediction_rate only
docs/source/mgwr_comparison.ipynb Updated notebook output reflecting removal of measure_performance parameter from model repr

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@martinfleis martinfleis merged commit ae39fac into main Dec 15, 2025
10 checks passed
@martinfleis martinfleis deleted the metrics-are-user-responsibility branch December 15, 2025 15:28
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.

1 participant