Created
February 14, 2022 10:43
-
-
Save nsorros/1f60e2a832dc35a5c840ce13bc153c58 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
def f(Y_pred_proba, Y_test, thresholds): | |
Y_pred = Y_pred_proba > thresholds | |
mlcm = multilabel_confusion_matrix(Y_test, Y_pred) | |
cm = mlcm.sum(axis=0) | |
tn, fp, fn, tp = cm.ravel() | |
f1 = tp / ( tp+ (fp+fn) / 2) | |
return f1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment