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

F1 score for missing class prediction #90

Open
tanfiona opened this issue Jun 9, 2022 · 0 comments
Open

F1 score for missing class prediction #90

tanfiona opened this issue Jun 9, 2022 · 0 comments

Comments

@tanfiona
Copy link

tanfiona commented Jun 9, 2022

I'm using the Huggingface implementation of seqeval, example codes as follows:

from datasets import load_metric

predictions = [['B-E', 'I-E', 'O', 'O', 'O', 'O', 'O', 'O']]
references = [['B-E', 'I-E', 'O', 'O', 'B-C', 'I-C', 'I-C', 'O']]

metric = load_metric('seqeval')
for i in range(len(predictions)):
    metric.add(
        prediction=predictions[i],
        reference=references[i] 
    )
results = metric.compute()
print(results)

My question is about the reported Overall F1 score. Given the references = [['B-E', 'I-E', 'O', 'O', 'B-C', 'I-C', 'I-C', 'O']]:

  • predictions = [['B-E', 'I-E', 'O', 'O', 'O', 'B-C', 'I-C', 'O']]: Returns overall_f1': 0.5, 'overall_accuracy': 0.75
  • predictions = [['B-E', 'I-E', 'O', 'O', 'O', 'O', 'O', 'O']]: Returns 'overall_f1': 0.6666666666666666, 'overall_accuracy': 0.625

Why is the F1 score higher for the second case with missing "C" class predictions? Shouldn't both cases return the same Overall F1 score? By the way, in both cases, F1 score for "C" is 0.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant