def plot_roc_auc(predictions, ground_truth, name=''):
# Calculate ROC curve
y_pred = np.asarray(predictions).ravel()
y_true = np.asarray(ground_truth).ravel()
fpr, tpr, thresholds = roc_curve(y_true, y_pred)
roc_auc = auc(fpr, tpr)
# Plot
plt.plot(fpr, tpr, label='{}, AUC = {:.3f}'.format(name, roc_auc))
# # Return index of best model by J statistic
# J = [j_statistic(y_true, y_pred, t) for t in thresholds]
#
# return thresholds[np.argmax(J)] # TODO test this out!
评论列表
文章目录