Skip to content

Commit

Permalink
Merge pull request #2 from HealthNLPorg/fix_v20230305
Browse files Browse the repository at this point in the history
Fix v20230305
  • Loading branch information
Jryao authored Mar 5, 2024
2 parents a4e884c + fdcf3fc commit ab2f9df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 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-02-23
Update for 2024-02-23 version: Fix `divided by zero exception` Line 405 at `eval_timeline.py`.
#### Current timestamp (YYYY-MM-DD): 2024-03-05
Update for 2024-03-05 version: Added exceptional case handling for situations where a patient doesn’t have gold standard timelines, and the system erroneously predicts timelines. In such cases, the system will now assign a score of 0 for that patient. This is described in detail in [Issue #1](https://github.com/HealthNLPorg/chemoTimelinesEval/issues/1).
<br>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:
Expand Down
12 changes: 9 additions & 3 deletions eval_timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import dateutil.parser

VERSION = "v20240223"
VERSION = "v20240305"

logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)
Expand Down Expand Up @@ -595,8 +595,14 @@ def macro_average_metrics(
1.0, 1.0, and 1.0 for the given patient in local precision, recall, and F1, respectively.
"""
if len(gold_timeline) == 0:
true_pos, false_pos, false_neg = [], [], []
p, r, f_score = 1, 1, 1
if len(pred_timeline) == 0:
true_pos, false_pos, false_neg = [], [], []
p, r, f_score = 1, 1, 1
else:
true_pos = []
false_pos = pred_timeline
false_neg = []
p, r, f_score = 0, 0, 0
local_relations[pred_patient] = 0
else:
logger.info(f"pred_patient ID: {pred_patient}")
Expand Down

0 comments on commit ab2f9df

Please sign in to comment.