Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
This code is the gives the AUC score of each and every class of the Chest X-Ray
auc_vals = []
for i in range(len(labels)):
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')
except ValueError:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment