chakki-works/seqeval

F1-score issue

Closed this issue · 1 comments

Hi,

I am trying to execute the code in this google colab notebook

https://colab.research.google.com/github/abhimishra91/transformers-tutorials/blob/master/transformers_ner.ipynb#scrollTo=9zwFzzBriLMO

but an error is generated when calculating the f1 score in the validation step

Screen Shot 2020-10-28 at 9 12 02 AM

could someone help plz
thank u

You should give a list of lists to f1_score:

>>> from seqeval.metrics import f1_score
>>> y_true = [['O', 'O', 'O', 'B-MISC', 'I-MISC', 'I-MISC', 'O'], ['B-PER', 'I-PER', 'O']]
>>> y_pred = [['O', 'O', 'B-MISC', 'I-MISC', 'I-MISC', 'I-MISC', 'O'], ['B-PER', 'I-PER', 'O']]
>>> f1_score(y_true, y_pred)
0.50