Instantly share code, notes, and snippets.

Embed
What would you like to do?
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