From 723ee4454d0e0a4fc1b9ee84ec2496e48b17a6fb Mon Sep 17 00:00:00 2001 From: Boying Gong Date: Fri, 11 Dec 2015 22:14:51 -0800 Subject: [PATCH] updated indeces for ROC curve --- code/scripts/logistic.py | 2 +- code/utils/logistic_function.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/scripts/logistic.py b/code/scripts/logistic.py index 72a080a..7669426 100644 --- a/code/scripts/logistic.py +++ b/code/scripts/logistic.py @@ -49,7 +49,7 @@ logreg_proba = logreg.predict_proba(X) confusion = create_confusion(logreg_proba, y) addsub = fig.add_subplot(4, 4, i) - addsub, AUC = plot_roc(confusion, addsub) + addsub, AUC = plot_roc(confusion, addsub, i) Min_thrs = np.append(Min_thrs, getMin_thrs(confusion)) AUC_smr = np.append(AUC_smr, AUC) diff --git a/code/utils/logistic_function.py b/code/utils/logistic_function.py index baad02c..00f8df1 100644 --- a/code/utils/logistic_function.py +++ b/code/utils/logistic_function.py @@ -60,7 +60,7 @@ def getMin_thrs(confusion): return thrs, false_pos, false_neg -def plot_roc(confusion, fig): +def plot_roc(confusion, fig, sub_i): """ function to plot the ROC (receiver operating characteristic) curve and calculate the corresponding AUC (Area Under Curve). @@ -97,5 +97,5 @@ def plot_roc(confusion, fig): AUC += (ROC[i+1,0]-ROC[i,0]) * (ROC[i+1,1]+ROC[i,1]) AUC *= -0.5 - plt.title('ROC curve, AUC = %.4f'%AUC) + plt.title('subject '+ str(sub_i)+', AUC = %.4f'%AUC) return fig, AUC