This code is the gives the AUC score of each and every class of the Chest X-Ray
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auc_vals = [] | |
for i in range(len(labels)): | |
try: | |
gt = np.array(testgenerator.labels[:, i]) | |
pred = predicted_vals[:,i] | |
gt = gt.astype('int64') | |
auc_vals.append(roc_auc_score(gt, pred)) | |
fpr_rf, tpr_rf, _ = roc_curve(gt, pred) | |
plt.figure(1, figsize=(10, 10)) | |
plt.plot([0, 1], [0, 1], 'k--') | |
plt.plot(fpr_rf, tpr_rf, label=labels[i] + " (" + str(round(auc_roc, 3)) + ")") | |
plt.xlabel('False positive rate') | |
plt.ylabel('True positive rate') | |
plt.title('ROC curve') | |
plt.legend(loc='best') | |
except ValueError: | |
pass | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment