t5-political-evaluator / my_metrics.py
pere's picture
first attempt - not finished
5c54fc2
raw
history blame
273 Bytes
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')}