Skip to content

Instantly share code, notes, and snippets.

@rohan-paul
Created October 22, 2021 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rohan-paul/5b869aebce7ae05fb7580eee0a82ce50 to your computer and use it in GitHub Desktop.
Save rohan-paul/5b869aebce7ae05fb7580eee0a82ce50 to your computer and use it in GitHub Desktop.
# Now generate TPR, FPR and ROC data
tpr,fpr,roc_auc = ([[]]*number_of_classes for _ in range(3))
f,ax = plt.subplots()
for i in range(number_of_classes):
fpr[i], tpr[i], _ = roc_curve(labels==i, predictions[:, i])
roc_auc[i] = auc(fpr[i], tpr[i])
ax.plot(fpr[i],tpr[i])
plt.legend(['Class {:d}'.format(d) for d in range(number_of_classes)])
plt.xlabel('FPR')
plt.ylabel('TPR')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment