Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sklearn.metrics import auc
- total = len(dat[target])
- one_count = np.sum(dat[target])
- one_count
- 33
- zero_count = total - one_count
- zero_count
- 766
- lm = [y for _,y in sorted(zip(dat[i],dat[target]),reverse=True)]
- x = np.arange(0,total+1)
- y = np.append([0],np.cumsum(lm))
- a = auc([0,total],[0,one_count])
- aP = auc([0,one_count,total],[0,one_count,one_count]) - a
- aR = auc(x,y) - a
- fpr, tpr, thresholds = roc_curve(target, var)
- auc_ = auc(fpr, tpr)
- ar = auc_ * 2 - 1
- print("Acc ratio:",aR/aP)
- print("Acc ratio from ROC curve:",2*roc_auc_score(dat[target],dat[i])-1)
- print("Acc ratio from ROC curve:",ar)
- Acc ratio: 0.9278423925943509
- Acc ratio from ROC curve: 0.775733839702508
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement