Skip to content

Commit

Permalink
Update eval_timeline.py to address divided by zero exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
wonjininfo committed Feb 23, 2024
1 parent 0d76e5d commit a4e884c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

## Evaluation script versioning

#### Current timestamp (YYYY-MM-DD): 2024-01-16
Update for this version: Initial release.
#### Current timestamp (YYYY-MM-DD): 2024-02-23
Update for 2024-02-23 version: Fix `divided by zero exception` Line 405 at `eval_timeline.py`.
<br>Update for 2024-01-16 version: Initial release.

#### Notice:
We have internally reviewed this script multiple times. However, should there be any concerns or feedback (i.e., if you find errors in this code), please let us know. We are open to feedback on the code until ~February 16, 2024~ **March 10, 2024**, and will respond within 3 calendar days.
Expand Down
4 changes: 3 additions & 1 deletion eval_timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import dateutil.parser

VERSION = "v20240116"
VERSION = "v20240223"

logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)
Expand Down Expand Up @@ -401,6 +401,8 @@ def evaluation(gold, pred, args):

if len(true_pos) + len(false_neg) == 0:
precision, recall, f1 = 0, 0, 0
elif len(true_pos) + len(false_pos) == 0:
precision, recall, f1 = 0, 0, 0
else:
precision = len(true_pos) / (len(true_pos) + len(false_pos))
recall = len(true_pos) / (len(true_pos) + len(false_neg))
Expand Down

0 comments on commit a4e884c

Please sign in to comment.