Repository navigation
PERF speed up confusion matrix calculation - #26820
Closed
adrinjalali wants to merge 1 commit into
Closed
adrinjalali wants to merge 1 commit into
adrinjalali wants to merge 1 commit into
Conversation
|
Hi, what is required to merge this change? |
Member
Author
|
reviews, our bottleneck is usually reviewer time ;) |
thomasjpfan
reviewed
Jul 25, 2023
thomasjpfan
left a comment
Member
There was a problem hiding this comment.
In principle, I like removing the unique calls. On the other hand, I do not like adding more to the public API. I'm overall +0.5.
Comment on lines
+424
to
+425
| unique_y_true=None, | ||
| unique_y_pred=None, |
Member
There was a problem hiding this comment.
labels, unique_y_true and unique_y_pred makes the public API looks really bloated. The only alternative I see is to have a private function.
Member
There was a problem hiding this comment.
I agree with @thomasjpfan. I see only 2 solutions:
- Make some private function where the public one is a wrapper around
- Implementing our own efficient
uniquefor NumPy arrays but it could be rather complex
(third solution is to contribute upstream :))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #26808
Speed up
confusion_matrixcalculation.This achieves the speedup by calculating the unique values on
y_trueandy_predonly once, and adds the required args along the way to the inner methods.Not sure about the names of the added args on public functions, and might need to refactor to hide them if necessary.
Also this needs to add the same for some other functions to make the tests pass, but for now this works, and brings the time from about 15s to 5s on my machine.