Created
June 23, 2015 06:26
-
-
Save bryanyang0528/5d8fef617fae187030ed to your computer and use it in GitHub Desktop.
ROC CURVE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def roc(pred, actual): | |
roc=[] | |
p=float(len(actual)-sum(actual)) | |
n=float(sum(actual)) | |
for i in range(0,100,1) : | |
TP=0 | |
FP=0 | |
i = float(i)/100 | |
for j in range(len(pred)): | |
if (pred[j] > i) & (actual[j]==0): | |
TP+=1 | |
if (pred[j] > i) & (actual[j]==1): | |
FP+=1 | |
roc.append((TP/p,FP/n)) | |
return roc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment