-
Notifications
You must be signed in to change notification settings - Fork 415
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
Reduce memory in classification metrics when average='micro'
#1286
Conversation
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, can we add a simple test-case asserting that this is actually used properly?
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.
Personally tested and worked flawlessly on MPS, reducing memory usage of the metric from 18GB to a few KB.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #1286 +/- ##
========================================
- Coverage 86% 49% -37%
========================================
Files 190 190
Lines 11108 11118 +10
========================================
- Hits 9607 5490 -4117
- Misses 1501 5628 +4127 |
Do you want test for memory consumption? |
* base impl * class change * change subclasses * changelog (cherry picked from commit acc933b)
would be great :) |
What does this PR do?
Fixes #1279
When
average='micro'
in multiclass classification we do not need to form the full[n_class, n_class]
confmat to do the calculations. This PR introduces a much simpler reduction that scales much better whenn_class
is a large number.Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃