Skip to content

Commit

Permalink
Update exception handling for cases without gold timelines
Browse files Browse the repository at this point in the history
This will close Issue #1
  • Loading branch information
wonjininfo committed Mar 5, 2024
1 parent a4e884c commit ae47163
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 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
10 changes: 8 additions & 2 deletions eval_timeline.py
Original file line number Diff line number Diff line change
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 ae47163

Please sign in to comment.