Created
October 3, 2018 07:45
-
-
Save vikramsoni2/614a95a5c0ad87de650f9b86a9062909 to your computer and use it in GitHub Desktop.
precision recall and auc plot
This file contains hidden or 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
def plot_auc_pr(y_test, y_pred): | |
fig = plt.figure(figsize=(20,7)) | |
plt.subplot(1,2,1) | |
fpr, tpr, _ = roc_curve(y_test, y_pred) | |
auc = roc_auc_score(y_test, y_pred) | |
plt.plot(fpr,tpr,label="auc="+str(auc)) | |
plt.title('roc-auc curve') | |
plt.legend(loc=4) | |
plt.subplot(1,2,2) | |
pr, rc, _ = precision_recall_curve(y_test, y_pred) | |
auc = roc_auc_score(y_test, y_pred) | |
plt.plot(pr,rc,label="auc="+str(auc)) | |
plt.title('precision recall curve') | |
plt.xlabel("precision") | |
plt.ylabel("recall") | |
plt.legend(loc=1 ) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment