Created
March 29, 2019 10:38
-
-
Save elena-roff/dd96a7faa3ae99da1eb56d1d294a96bd to your computer and use it in GitHub Desktop.
Precision / Recall curve
This file contains 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
from sklearn.metrics import precision_score, recall_score, precision_recall_curve | |
import matplotlib.pyplot as plt | |
def plt_prc(recall, precision, label=None): | |
plt.step(recall, precision, label=label) | |
plt.xlabel('Recall') | |
plt.ylabel('Precision') | |
plt.ylim([0.0, 1.05]) | |
plt.xlim([0.0, 1.0]) | |
precision, recall, thresholds = precision_recall_curve(data['label'], data['probability'] | |
_ = plt_prc(recall, precision, label=f'PRC {<description of plot>}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment