In [1]:
from sklearn.metrics import f1_score

In [2]:
y_true = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]
y_pred = [0, 1, 1, 1, 1, 0, 0, 0, 1, 1]

In [3]:
print(f1_score(y_true, y_pred))


0.3636363636363636