-4

I want to set the floating-point precision of AUC (shown in the legend) to 4 digits. I used the default function available in sklearn.metrics.RocCurveDisplay. Also I would like to import the yes no results of each fold into a separate excel file. Can anyone fix the cod and share how to add additional decimal places and import results in an excel file

mean_tpr = np.mean(tprs, axis=0)
mean_tpr[-1] = 1.0
mean_auc = auc(mean_fpr, mean_tpr)
std_auc = np.std(aucs)
ax.plot(
mean_fpr,
mean_tpr,
color="b",
label=r"Mean ROC (AUC = %0.2f $\pm$ %0.2f)" % (mean_auc, std_auc),
lw=2,
alpha=0.8,
)

std_tpr = np.std(tprs, axis=0)
tprs_upper = np.minimum(mean_tpr + std_tpr, 1)
tprs_lower = np.maximum(mean_tpr - std_tpr, 0)
 ax.fill_between(
 mean_fpr,
 tprs_lower,
 tprs_upper,
 color="grey",
 alpha=0.2,
 label=r"$\pm$ 1 std. dev.",
  )

ax.set(
xlim=[-0.05, 1.05],
ylim=[-0.05, 1.05],
xlabel="False Positive Rate",
ylabel="True Positive Rate",
title=f"Mean ROC curve with variability\n(Positive label)",
  )
 ax.axis("square")
 ax.legend(loc="lower right")
 #mpl.text.set_fontfamily("Times New Roman")
 plt.show()
Samiul
  • 51
  • 5
  • This is neither **minimal**, nor reproducible (contributors can not copy, paste, and run this code). Please review #3 and #9 in [Creating Effective Stack Overflow Questions](https://trenton3983.github.io/files/Creating_Effective_StackOverflow_Questions.html) – Trenton McKinney Aug 26 '23 at 17:42
  • The code is not properly formatted either. Code following `for fold, (train, test) in enumerate(cv.split(X1, y)):` is not indented. It's not clear if the 2nd for loop is part of the first loop. The post also contains multiple unrelated questions. A post may contain a single question. – Trenton McKinney Aug 26 '23 at 17:57

0 Answers0