lavis-nlp / spert

PyTorch code for SpERT: Span-based Entity and Relation Transformer
MIT License
685 stars 146 forks source link

Is it possiable that the prediction result would be nested for NER task? #42

Closed MingHong1019 closed 3 years ago

MingHong1019 commented 3 years ago

to be specifically, for example, let the sentence "The apple corporation" as input, is there any possible that the span ["The apple corporation"] is predicted as the label 'ORG' however, the span ["The apple"] is predicted as label the 'Other'? If so, what is the final prediction of input sentence "The apple corporation"?

by the way, in the training progress, after random sample, the max neg-span number is 100. But it is also seems much larger than the number of label span. For example, the sentence is made by 27 word, and the number of entities are 5, hence the labelentity span will be 5 whereas the neg_entity_span are 100. Will it be harmful for training the model?

markus-eberts commented 3 years ago
  1. Since we are using a span based approach, SpERT indeed is able to detect overlapping entity mentions. So in your example, SpERT would return two mentions, "The Apple" labeled with "Other" and "The Apple cooperation" labeled with "Org". Of course this requires your training data to contain such overlapping samples.

  2. I think we had a similar ratio in the datasets used in our paper and it worked out fine. As always, a (automated or manual) hyperparameter search may be useful when working with a new dataset. You can change the negative entity count in the config file.

markus-eberts commented 3 years ago

I assume this answered your question, please write a comment otherwise.