-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Relation Classifier Encoding Strategies #3023
Conversation
…being fully configurable
- Rename mentions of `masked_sentence` to `encoded_sentence`
…n into one test - Add transformation test for entity-mask and typed-entity-mask
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dobbersc for improving this!
In testing this PR, I noticed some discrepancies between the parameters of RelationExtractor
and RelationClassifier
related to the (kind of confusing) issue of whether a RE dataset is fully annotated like RE_ENGLISH_CONLL04
and thus usable without a prior "relation identification" step, or whether only a subset of entity pairs is annotated like in TACRED or SemEval.
For RE_ENGLISH_CONLL04
one would instantiate the RelationClassifier
like this:
model: RelationClassifier = RelationClassifier(
embeddings=embeddings,
label_dictionary=label_dictionary,
label_type="relation",
entity_label_types="ner",
cross_augmentation=True,
)
and the RelationExtractor
like this:
model: RelationExtractor = RelationExtractor(
embeddings=embeddings,
label_dictionary=label_dictionary,
label_type="relation",
entity_label_type="ner",
train_on_gold_pairs_only=False,
)
So, the params entity_label_type
/ entity_label_types
and train_on_gold_pairs_only
/ cross_augmentation
have different names. Perhaps align the naming?
Thanks, @alanakbik for testing the PR.
I agree that The |
@dobbersc thanks, merging now! |
This PR implements several encoding strategies from this paper for the relation classifier. The original relation classifier was designed for the (typed) entity mask encoding strategy. Now, the model is more general, with the encoding strategy as a hyperparameter. The interface also enables us to easily add more encoding strategies.