Created
April 13, 2021 05:09
-
-
Save shedoesdatascience/f65acce63fc70bdf99ca6388d93b9e0a to your computer and use it in GitHub Desktop.
ROC curve on Iris dataset
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
import pylab as pl | |
# Compute ROC curve and area the curve | |
fpr, tpr, thresholds = roc_curve(y_test, probas_[:, 1]) | |
roc_auc = auc(fpr, tpr) | |
print("Area under the ROC curve : %f" % roc_auc) | |
# Plot ROC curve | |
pl.clf() | |
pl.plot(fpr, tpr, label='ROC curve (area = %0.2f)' % roc_auc) | |
pl.plot([0, 1], [0, 1], 'k--') | |
pl.xlim([0.0, 1.0]) | |
pl.ylim([0.0, 1.0]) | |
pl.xlabel('False Positive Rate') | |
pl.ylabel('True Positive Rate') | |
pl.title('Receiver operating characteristic example') | |
pl.legend(loc="lower right") | |
pl.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment