Thanks to visit codestin.com
Credit goes to github.com

Skip to content

plot iso-f1 curves in plot_precision_recall #8366

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions examples/model_selection/plot_precision_recall.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,21 @@
average="micro")


# Plot ISO-F1 curve
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ISO is international standards organisation. "Iso-" is a greek-derived prefix meaning equal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aah yes, will change it!

plt.clf()
f_scores = np.linspace(0.1, 0.9, num=9)
for F in f_scores:
x = R = np.linspace(0.01, 1)
y = F * R / (2 * R - F)
plt.plot(x[y >= 0], y[y >= 0], color='navy')
plt.annotate('f1={0:0.1f}'.format(F), xy=(0.9, y[45] + 0.02))
plt.xlabel('Recall')
plt.ylabel('Precision')
plt.xlim([0.0, 1.0])
plt.ylim([0.0, 1.0])
plt.title('ISO-F1 curves')
plt.show()

# Plot Precision-Recall curve
plt.clf()
plt.plot(recall[0], precision[0], lw=lw, color='navy',
Expand Down