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

Wrong Mention Type one-hot vectors during training due to a small bug in dataset.py #340

Open
valedica opened this issue Mar 11, 2022 · 0 comments · May be fixed by #341
Open

Wrong Mention Type one-hot vectors during training due to a small bug in dataset.py #340

valedica opened this issue Mar 11, 2022 · 0 comments · May be fixed by #341

Comments

@valedica
Copy link

I think there is a small bug in dataset.py that affects the building of the Mention Type one-hot vectors of antecedent mentions in the pair features during training. Due to the use of slicing by a colon in the first dimension, the assignment is made on the full columns referred by the index in the 1-D array ant_features_raw[:, 0], which contains the mention type of the antecedent mentions expressed as integer. The expected behaviour I think was to put at 1 a single bit only, indexed by the 1-D array, for each row/antecedent mention, as it's done for the main mention.

ant_features = np.zeros((pairs_length, SIZE_FS - SIZE_GENRE))
ant_features[:, ant_features_raw[:, 0]] = 1

This causes a mismatch between the training features and the inference ones: in neuralcoref.pyx, the mention type is correctly encoded as a one-hot vector for each mention, and then copied in the pair features for the antecedent mentions.

This is a simple example with numpy comparing actual vs expected results:
Screenshot 2022-03-11 at 13 09 25

@valedica valedica linked a pull request Mar 11, 2022 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant