Last active
July 1, 2018 19:27
-
-
Save aswalin/4cbab393ac9cbc17d51972473bd28683 to your computer and use it in GitHub Desktop.
This file contains 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
from sklearn import metrics | |
import numpy as np | |
y_true = np.concatenate((np.ones(100), np.zeros(900))) | |
a = np.random.uniform(0.5,1, 5) | |
b = np.random.uniform(0,0.5, 995) | |
y_pred1 = np.concatenate((a,b)) | |
a = np.random.uniform(0.5,1, 90) | |
b = np.random.uniform(0,0.5, 910) | |
y_pred2 = np.concatenate((a,b)) | |
print(metrics.f1_score(y_true, y_pred1>0.5)) | |
print(metrics.f1_score(y_true, y_pred2>0.5)) | |
print(metrics.roc_auc_score(y_true, y_pred1)) | |
print(metrics.roc_auc_score(y_true, y_pred2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment