Skip to content

Instantly share code, notes, and snippets.

@shedoesdatascience
Created April 13, 2021 05:09
Show Gist options
  • Save shedoesdatascience/f65acce63fc70bdf99ca6388d93b9e0a to your computer and use it in GitHub Desktop.
Save shedoesdatascience/f65acce63fc70bdf99ca6388d93b9e0a to your computer and use it in GitHub Desktop.
ROC curve on Iris dataset
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