File size: 273 Bytes
8993bac
 
 
 
0173bf7
8993bac
 
1
2
3
4
5
6
7
8
import sklearn.metrics
import numpy as np

def f1_macro(targets, predictions):
      targets, predictions = np.asarray(targets).astype(str), np.asarray(predictions).astype(str)
      return {"f1_macro": 100*sklearn.metrics.f1_score(targets, predictions, average='macro')}