Skip to content

Commit

Permalink
Merge pull request ageron#65 from patsancu/remove-hardcoded-recall-pr…
Browse files Browse the repository at this point in the history
…ecision-threshold-coordinates

remove hardcoded values for recall-precision-threshold intersection
  • Loading branch information
ageron authored Feb 4, 2020
2 parents 429df4e + 59c2223 commit 47bbf77
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions 03_classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -803,14 +803,20 @@
" plt.grid(True) # Not shown\n",
" plt.axis([-50000, 50000, 0, 1]) # Not shown\n",
"\n",
"plt.figure(figsize=(8, 4)) # Not shown\n",
"\n",
"\n",
"recall_90_precision = recalls[np.argmax(precisions >= 0.90)]\n",
"threshold_90_precision = thresholds[np.argmax(precisions >= 0.90)]\n",
"\n",
"\n",
"plt.figure(figsize=(8, 4)) # Not shown\n",
"plot_precision_recall_vs_threshold(precisions, recalls, thresholds)\n",
"plt.plot([7813, 7813], [0., 0.9], \"r:\") # Not shown\n",
"plt.plot([-50000, 7813], [0.9, 0.9], \"r:\") # Not shown\n",
"plt.plot([-50000, 7813], [0.4368, 0.4368], \"r:\")# Not shown\n",
"plt.plot([7813], [0.9], \"ro\") # Not shown\n",
"plt.plot([7813], [0.4368], \"ro\") # Not shown\n",
"save_fig(\"precision_recall_vs_threshold_plot\") # Not shown\n",
"plt.plot([threshold_90_precision, threshold_90_precision], [0., 0.9], \"r:\") # Not shown\n",
"plt.plot([-50000, threshold_90_precision], [0.9, 0.9], \"r:\") # Not shown\n",
"plt.plot([-50000, threshold_90_precision], [recall_90_precision, recall_90_precision], \"r:\")# Not shown\n",
"plt.plot([threshold_90_precision], [0.9], \"ro\") # Not shown\n",
"plt.plot([threshold_90_precision], [recall_90_precision], \"ro\") # Not shown\n",
"save_fig(\"precision_recall_vs_threshold_plot\") # Not shown\n",
"plt.show()"
]
},
Expand Down

0 comments on commit 47bbf77

Please sign in to comment.