From 590b5e95ca07753627ee7b3e003ec13418869b86 Mon Sep 17 00:00:00 2001 From: Jim Martens Date: Mon, 15 Jul 2019 14:46:09 +0200 Subject: [PATCH] Change f1 score to single value Signed-off-by: Jim Martens --- src/twomartens/masterthesis/evaluate.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/twomartens/masterthesis/evaluate.py b/src/twomartens/masterthesis/evaluate.py index 6b45b7c..0fe60b7 100644 --- a/src/twomartens/masterthesis/evaluate.py +++ b/src/twomartens/masterthesis/evaluate.py @@ -305,7 +305,8 @@ def get_f1_score(cumulative_precisions: List[np.ndarray], if not np.count_nonzero(cumulative_precision + cumulative_recall): cumulative_f1_scores.append([]) continue - f1_score = 2 * ((cumulative_precision * cumulative_recall) / (cumulative_precision + cumulative_recall + 0.001)) + f1_score = 2 * ((cumulative_precision[-1] * cumulative_recall[-1]) / + (cumulative_precision[-1] + cumulative_recall[-1] + 0.001)) cumulative_f1_scores.append(f1_score) return cumulative_f1_scores