-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MRG + 1] Plot iso-f1 curves in plot_precision_recall example #8378
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
I had removed the previous branch from my fork, so was unable to force push the changes in the same PR, my bad! |
Codecov Report
@@ Coverage Diff @@
## master #8378 +/- ##
=======================================
Coverage 94.75% 94.75%
=======================================
Files 342 342
Lines 60801 60801
=======================================
Hits 57609 57609
Misses 3192 3192 Continue to review full report at Codecov.
|
Waiting for reviews! |
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.
Looks good to me, thank you for your contribution!
labels = [] | ||
for F in f_scores: | ||
x = R = np.linspace(0.01, 1) | ||
y = F * R / (2 * R - F) |
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.
I would rather use lower case variable names for 1d vectors.
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.
also you could use f_score
instead of f
maybe? And reuse x
instead of R
?
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.
+1 from me once addressed...
labels = [] | ||
for F in f_scores: | ||
x = R = np.linspace(0.01, 1) | ||
y = F * R / (2 * R - F) |
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.
also you could use f_score
instead of f
maybe? And reuse x
instead of R
?
|
Also can you set an alpha param to control translucency on the iso-f1? |
a1b4837
to
7dc3e06
Compare
Codecov Report
@@ Coverage Diff @@
## master #8378 +/- ##
=======================================
Coverage 94.75% 94.75%
=======================================
Files 342 342
Lines 60813 60813
=======================================
Hits 57621 57621
Misses 3192 3192 Continue to review full report at Codecov.
|
Yes, changes made according to the reviews! I set alpha=0.2. |
I think we should cut it back to 0.2, 0.4, 0.6, 0.8. Nine curves are too many |
okay! 👍 |
7dc3e06
to
d30ed84
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.
That's it looks good to me... Thanks! Will merge when the CIs pass...
You're welcome :) |
Or increase the size of the plot such that it can fit into the enlarged blank space... |
d30ed84
to
f74d7d6
Compare
Perfect. Thanks! |
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.
Also can you remove the plt.show above? it makes it not to display in the docs... (it's not a part of this pr actually...)
for f_score in f_scores: | ||
x = np.linspace(0.01, 1) | ||
y = f_score * x / (2 * x - f_score) | ||
l, = plt.plot(x[y >= 0], y[y >= 0], color='gray', alpha=0.2) |
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.
unneeded , ?
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.
Also can you directly do append here?
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.
without the ,
, l becomes [<matplotlib.lines.Line2D object at 0x7f43d13912e8>]
, which is not supported by legend
(a UserWarning is raised). Using a ,
returns a line instance Line2D(_line3)
which is what the legend
function accepts! So, the lines have to be appended separately.
''.format(i, average_precision[i])) | ||
|
||
l, = plt.plot(recall[i], precision[i], color=color, lw=lw) | ||
lines.append(l) |
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.
same comment as above...
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.
same as above.
The previous curve(pr curve for class 0) is already been included in the next plot(which is being displayed in the docs). |
f74d7d6
to
0374684
Compare
I am still +1 for merging :) |
Let's merge then. |
Thanks @SACHIN-13 ! |
Reference Issue
Fixes #8313
What does this implement/fix? Explain your changes.
While plotting PR curves, it separates out the curves with equal f1 values.
Any other comments?
An edit to my previous PR #8366