Skip to content

F1 score for missing class prediction #90

Description

@tanfiona

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions