-
Notifications
You must be signed in to change notification settings - Fork 87
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
Modify calculate_percent_difference so that it can handle negative values #1100
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1100 +/- ##
==========================================
+ Coverage 94.06% 99.91% +5.84%
==========================================
Files 192 192
Lines 10736 10751 +15
==========================================
+ Hits 10099 10742 +643
+ Misses 637 9 -628
Continue to review full report at Codecov.
|
evalml/objectives/objective_base.py
Outdated
elif baseline_score < score and cls.greater_is_better: | ||
increase = True | ||
elif baseline_score > score and cls.greater_is_better: | ||
increase = False | ||
elif baseline_score < score and not cls.greater_is_better: | ||
increase = False | ||
else: | ||
increase = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I wonder if this can be simplified a little? Suggestion:
increase = True
if (baseline_score > score and cls.greater_is_better) or (baseline_score < score and not cls.greater_is_better):
increase = False
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call! Really makes things cleaner. I think I was just being paranoid I would miss a case hehe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hahaha I don't blame you, I had to write it all out and make sure too 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test case looks good, just commented on maybe simplifying the checks!
0e6d9f0
to
0850cf9
Compare
0850cf9
to
f9dba67
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm!
evalml/objectives/objective_base.py
Outdated
|
||
increase = True | ||
if (baseline_score > score and cls.greater_is_better) or (baseline_score < score and not cls.greater_is_better): | ||
increase = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. My only thought is maybe you can invert it so you don't need the not in not increase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Pull Request Description
Let's say for CostBenefitMatrix, the model score is 5 and the baseline score is -10.
Right now, we compute 100 * (5 - (-10))/ -10 = -150%, indicating a decrease in performance when the right answer should be a 150% increase in performance.
This PR fixes that and adds coverage.
After creating the pull request: in order to pass the release_notes_updated check you will need to update the "Future Release" section of
docs/source/release_notes.rst
to include this pull request by adding :pr:123
.