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

Fix error in BooleanAccuracy when total count is 0 #2991

Merged
merged 2 commits into from
Jul 8, 2019
Merged

Fix error in BooleanAccuracy when total count is 0 #2991

merged 2 commits into from
Jul 8, 2019

Conversation

abhishek0318
Copy link
Contributor

Fixes #2822

@abhishek0318 abhishek0318 changed the title Fix error when count is 0 Fix error in BooleanAccuracy when total count is 0 Jun 26, 2019
@@ -84,7 +84,10 @@ def get_metric(self, reset: bool = False):
-------
The accumulated accuracy.
"""
accuracy = float(self._correct_count) / float(self._total_count)
if self._total_count > 1e-12:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't you just test this against 0?

@matt-gardner matt-gardner merged commit 715422c into allenai:master Jul 8, 2019
reiyw pushed a commit to reiyw/allennlp that referenced this pull request Nov 12, 2019
* Fix error when count is 0

* Update boolean_accuracy.py
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.

Avoid divide by zero in Boolean Accuracy
3 participants