Skip to content

Commit

Permalink
Merge pull request #116 from boyinggong/dev
Browse files Browse the repository at this point in the history
updated indeces for ROC curve
  • Loading branch information
BenjaminHsieh committed Dec 12, 2015
2 parents 122e406 + d915ff2 commit af5c9ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion code/scripts/logistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions code/utils/logistic_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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

0 comments on commit af5c9ba

Please sign in to comment.