Skip to content

Add score_ attribute based on pooled local model performance (BaseClassifier) - #118

Closed
jigyasaba wants to merge 16 commits into
pysal:mainfrom
jigyasaba:Score_attribute_branch
Closed

Add score_ attribute based on pooled local model performance (BaseClassifier)#118
jigyasaba wants to merge 16 commits into
pysal:mainfrom
jigyasaba:Score_attribute_branch

Conversation

@jigyasaba

Copy link
Copy Markdown
Contributor

This PR introduces a score_ attribute to BaseClassifier, computed after fit() for convenient access to training performance.

Motivation:

There has been some ambiguity around how model performance is evaluated, as discussed in Issue #30 (API consistency for metrics). Currently, .score() relies on predict(), which uses an ensemble of local models. However, during training we already compute local model outputs that can be aggregated more directly.

This PR follows the direction outlined in the discussion and TODO:
TODO: score_ should be an alias of pooled_score_(linear_model.py)

Implementation:

  • Added computation of pooled_score_ using:
    concatenated _y_local
    concatenated _pred_local

  • Defined:
    self.score_ = self.pooled_score_

  • This ensures:
    score_ reflects pooled local model performance
    avoids confusion with .score() (ensemble-based)
    (Not reused .score() which uses predict() which ultimately uses ensemble of local models instead used score_ which uses pooled local model outputs)

Tests:

  • Added test to verify:
    score_attribute exists
    score_matches pooled_score_
    value is within valid range
    (Applies only to BaseClassifier for now and does not modify existing .score() behavior)

Open to feedbacks and suggestions.

jigyasaba and others added 14 commits February 20, 2026 14:32
up# the commit.    all clean
…ysal#117)

Bumps the github-actions group with 1 update: [actions/github-script](https://github.com/actions/github-script).


Updates `actions/github-script` from 8 to 9
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](actions/github-script@v8...v9)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-version: '9'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@codecov

codecov Bot commented Apr 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.42%. Comparing base (a687b09) to head (ad6220d).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #118      +/-   ##
==========================================
+ Coverage   92.35%   92.42%   +0.06%     
==========================================
  Files           6        6              
  Lines         876      884       +8     
==========================================
+ Hits          809      817       +8     
  Misses         67       67              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jigyasaba

Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

@martinfleis

Copy link
Copy Markdown
Member

This is a duplicate of #76. Please see the discussion there.

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.

2 participants