diff --git a/README.md b/README.md index 5882a19..3f284e5 100644 --- a/README.md +++ b/README.md @@ -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). +
Update for 2024-02-23 version: Fix `divided by zero exception` Line 405 at `eval_timeline.py`.
Update for 2024-01-16 version: Initial release. #### Notice: diff --git a/eval_timeline.py b/eval_timeline.py index f420114..bf34b2f 100644 --- a/eval_timeline.py +++ b/eval_timeline.py @@ -7,7 +7,7 @@ import dateutil.parser -VERSION = "v20240223" +VERSION = "v20240305" logger = logging.getLogger(__name__) logger.setLevel(logging.WARNING) @@ -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}")