-
-
Save amankharwal/8f85b43e2faaef05045ec8a5580d4302 to your computer and use it in GitHub Desktop.
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 import metrics | |
auc = metrics.roc_auc_score(y_test, y_pred) | |
false_positive_rate, true_positive_rate, thresolds = metrics.roc_curve(y_test, y_pred) | |
plt.figure(figsize=(10, 8), dpi=100) | |
plt.axis('scaled') | |
plt.xlim([0, 1]) | |
plt.ylim([0, 1]) | |
plt.title("AUC & ROC Curve") | |
plt.plot(false_positive_rate, true_positive_rate, 'g') | |
plt.fill_between(false_positive_rate, true_positive_rate, facecolor='lightgreen', alpha=0.7) | |
plt.text(0.95, 0.05, 'AUC = %0.4f' % auc, ha='right', fontsize=12, weight='bold', color='blue') | |
plt.xlabel("False Positive Rate") | |
plt.ylabel("True Positive Rate") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment