Here's a simple code to plot ROC curve for binary classification using scikit-learn library in Python:
main.py624 chars20 lines
In the above code, we first import roc_curve and auc from sklearn.metrics library. Then we predict the probabilities y_score of class 1 and true labels y_true. Then, we calculate fpr (false positive rate) and tpr (true positive rate) using roc_curve function. Finally, we plot the ROC curve using matplotlib.pyplot library.
gistlibby LogSnag