R's ROCR package provides options for ROC curve plotting that will color code and label threshold values along the curve:

The closest I can get with Python is something like
from sklearn.metrics import roc_curve
fpr, tpr, thresholds = roc_curve(qualityTrain.PoorCare, qualityTrain.Pred1)
plt.plot(fpr, tpr, label='ROC curve', color='b')
plt.axes().set_aspect('equal')
plt.xlim([-0.05, 1.05])
plt.ylim([-0.05, 1.05])
which gives

Are there packages that provide functionality equivalent to R's ability to label (using print.cutoffs.at) and color code (using colorize) thresholds? Presumably this information is in thresholds, returned by sklearn.metrics.roc_curve, but I can't figure out how to use it to color code and label the figure.
Look at this gist:
https://gist.github.com/podshumok/c1d1c9394335d86255b8
roc_data = sklearn.metrics.roc_curve(...)
plot_roc(*roc_data, label_every=5)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With