Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] ScoringSheetViewer computing target class values from base values #7025

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ZanMervic
Copy link
Contributor

Issue

Fixes #6996

Description of changes
  • Refactors the ScoringSheetViewer widget so the displayed values are computed from base values which never change.
  • Sorts the attributes by importance (absolute value of coefficients), so the most important attributes are displayed on top.
Includes
  • Code changes
  • Tests
  • Documentation

Copy link

codecov bot commented Feb 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.62%. Comparing base (7be875f) to head (67f6d2d).
Report is 24 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7025      +/-   ##
==========================================
+ Coverage   88.36%   88.62%   +0.25%     
==========================================
  Files         332      332              
  Lines       73345    73381      +36     
==========================================
+ Hits        64813    65034     +221     
+ Misses       8532     8347     -185     

@janezd janezd self-assigned this Feb 14, 2025
@ZanMervic ZanMervic force-pushed the bugfix/6996/use-base-values-on-target-switch branch from f79ef51 to 67f6d2d Compare March 1, 2025 00:58
@@ -510,15 +515,32 @@ def _extract_data_from_model(self, classifier):
all_risks = 1 / (1 + np.exp(-all_scaled_scores))

self.attributes = attributes
self._base_coefficients = coefficients
self._base_all_scores = all_scores.tolist()
self._base_all_risks = (all_risks * 100).tolist()
self.coefficients = coefficients
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these three lines still necessary? These attributes are set in self._adjust_for_target_class, which is called a few lines later.

Sorts the attributes in descending order of importance (absolute coefficient value)
by combining the attributes and coefficients into tuples and sorting them.
"""
combined = list(
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to call list here. You can pass a zip object to sorted; sorted will work on any iterable.

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.

Scoring Sheet Viewer: Refactor
2 participants