-
-
Notifications
You must be signed in to change notification settings - Fork 26.1k
Refactor of metrics.roc_curve method #350
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
Conversation
The new implementation, even if it looks very naive, reduces the computation time of fpr/tpr vectors. roc_curve computation time depends now only on the length of y_score. For comparison, here are the results between the old and the new implementation for the following vectors: - 10^6 length vector (y_score has 1000 unique values): - old impl.: 28.29 seconds - new impl.: 3.14 seconds - 10^6 length vector (y_score has 10000 unique values): - old impl.: 267.61 seconds - new impl.: 3.64 seconds
tpr = np.empty(thresholds.size) # True positive rate | ||
fpr = np.empty(thresholds.size) # False positive rate | ||
|
||
# Buid tpr/fpr vector |
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.
s/Buid/Build/ ?
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.
fixed in 0c25d43
Also please merge the upstream master into your branch as your as still using the old package names and this branch is not mergeable as it is. |
ping @agramfort (this PR review is for you :) |
@@ -121,16 +121,39 @@ def roc_curve(y_true, y_score): | |||
|
|||
y_score = y_score.ravel() | |||
thresholds = np.sort(np.unique(y_score))[::-1] |
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.
this "thresholds“ is not used later.
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.
ooops .... reminiscence of the old implementation :-/.
Fixed in 52cc103
Adds dtype on tpr/fpr array creation.
Refactor and speed up of metrics.roc_curve method
The new implementation, even if it looks very naive, reduces the
computation time of fpr/tpr vectors.
roc_curve computation time depends now only on the length of y_score.
For comparison, here are the results between the old and the new
implementation for the following vectors: