I have a boosted trees model and probabilities and classification for test data set. I am trying to plot the roc_curve for the same. But I am unable to figure out how to define thresholds/alpha for roc curve in scikit learn.
from sklearn.metrics import precision_recall_curve,roc_curve,auc, average_precision_score
fpr = dict()
tpr = dict()
roc_auc = dict()
fpr,tpr,_ = roc_curve(ytest,p_test, pos_label=1)
roc_auc = auc(fpr,tpr)
plt.figure()
lw = 2
plt.plot(fpr, tpr, color='darkorange', lw=lw, label='ROC curve (area = %0.2f)' % roc_auc)
plt.plot([0, 1], [0, 1], color='navy', lw=lw, linestyle='--')
plt.xlim([0.0, 1.0])
plt.ylim([0.0, 1.05])
plt.xlabel('False Positive Rate')
plt.ylabel('True Positive Rate')
plt.title('Receiver operating characteristic example')
plt.legend(loc="lower right")
plt.savefig('ROCProb.png')
plt.show()
I looked at a similar question here : thresholds in roc_curve in scikit learn
But could not figure out. I am open to using some other library as well.
roc_curve
(the variable _ in your case) – sgDysregulation