Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug - labels are only taken from true data #39

Closed
yoeldk opened this issue Jul 24, 2020 · 3 comments · Fixed by #54
Closed

Bug - labels are only taken from true data #39

yoeldk opened this issue Jul 24, 2020 · 3 comments · Fixed by #54
Labels
bug Something isn't working

Comments

@yoeldk
Copy link

yoeldk commented Jul 24, 2020

Example:
from seqeval.metrics import classification_report
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', 'B-TEST']]

print(classification_report(y_true, y_pred))

The result is:
           precision    recall  f1-score   support

      PER       1.00      1.00      1.00         1
     MISC       0.00      0.00      0.00         1

micro avg       0.33      0.50      0.40         2
macro avg       0.50      0.50      0.50         2

As you can see B-TEST does not appear in the table even though it's a false positive (it only appears in the predicted labels). The complete label list should be comprised from the union of true_labels + predicted_labels.

@icoxfog417 icoxfog417 added the question Further information is requested label Jul 26, 2020
@yoeldk
Copy link
Author

yoeldk commented Aug 4, 2020

@icoxfog417 isn't it a bug?

@yoeldk
Copy link
Author

yoeldk commented Sep 26, 2020

@icoxfog417 Can you explain why it is labeled as a question and not a bug?

@Hironsan Hironsan added bug Something isn't working and removed question Further information is requested labels Sep 30, 2020
@Hironsan
Copy link
Member

@yoeldk As of v1.0.0:

>>> from seqeval.metrics import classification_report
>>> from seqeval.scheme import IOB2
>>> 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', 'B-TEST']]
>>> print(classification_report(y_true, y_pred, mode='strict', scheme=IOB2))
              precision    recall  f1-score   support

        MISC       0.00      0.00      0.00         1
         PER       1.00      1.00      1.00         1
        TEST       0.00      0.00      0.00         0

   micro avg       0.33      0.50      0.40         2
   macro avg       0.33      0.33      0.33         2
weighted avg       0.50      0.50      0.50         2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants