Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Fixed minor error while calculating span accuracy #2923

Merged
merged 5 commits into from
Jun 10, 2019
Merged

Fixed minor error while calculating span accuracy #2923

merged 5 commits into from
Jun 10, 2019

Conversation

abhishek0318
Copy link
Contributor

Inputs to BooleanAccuracy must have the same dimensions. Here, the first argument has dimensions (batch size, 2), while the second argument has dimensions (batch size, 1, 2). Changing torch.stack to torch.cat makes the dimension of the second argument (batch size, 2).

Note that span accuracy obtained earlier was not incorrect because of the way accuracy was being computed internally.

@kl2806
Copy link
Contributor

kl2806 commented Jun 5, 2019

Thanks! Would you mind raising a config error checking that they are the same dimension similar to: https://github.com/allenai/allennlp/blob/master/allennlp/training/metrics/categorical_accuracy.py#L48
and a test that checks for this similar to

with pytest.raises(ConfigurationError):

@matt-gardner
Copy link
Contributor

Minor point: config errors should only be used when the error reasonably came from a configuration file problem. That's probably not the case here, and a value error would be more appropriate.

@abhishek0318
Copy link
Contributor Author

Thanks! Would you mind raising a config error checking that they are the same dimension similar to and a test that checks for this similar to.

Sure. I will do it over the weekend.

@kl2806 kl2806 self-requested a review June 7, 2019 22:28
@abhishek0318
Copy link
Contributor Author

I have added the checks and the corresponding tests. Please take a look.

Copy link
Contributor

@kl2806 kl2806 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I made some minor changes

@kl2806 kl2806 merged commit c0f44f7 into allenai:master Jun 10, 2019
reiyw pushed a commit to reiyw/allennlp that referenced this pull request Nov 12, 2019
* Fixed minor error while calculating span accuracy

* Added checks for input shape in BooleanAccuracy

* Fixed label shape in QaNet

* Use f-string
TalSchuster pushed a commit to TalSchuster/allennlp-MultiLang that referenced this pull request Feb 20, 2020
* Fixed minor error while calculating span accuracy

* Added checks for input shape in BooleanAccuracy

* Fixed label shape in QaNet

* Use f-string
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants