From 05bdcd6b6261e83b6f925d67241a13211f590d41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=BChle=2C=20Laura=20Christine=20=28lakue103=29?=
 <laura.kuehle@uni-duesseldorf.de>
Date: Tue, 1 Feb 2022 18:10:08 +0100
Subject: [PATCH] Removed error for missing classes in ANN evaluation.

---
 ANN_Training.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ANN_Training.py b/ANN_Training.py
index 395cf26..bd3403c 100644
--- a/ANN_Training.py
+++ b/ANN_Training.py
@@ -9,7 +9,7 @@ TODO: Test new ANN set-up with Soraya
 TODO: Remove object set-up (for more flexibility)
 TODO: Add documentation
 TODO: Improve log output (timer, bit of text) -> Done
-TODO: Throw exception for error due to missing classes
+TODO: Remove error for missing classes -> Done
 TODO: Allow multiple approximations in one config
 
 """
@@ -130,7 +130,8 @@ class ModelTrainer(object):
         y_true = y_test.detach().numpy()[:, 1]
         y_pred = model_output.detach().numpy()
         accuracy = accuracy_score(y_true, y_pred)
-        precision, recall, f_score, support = precision_recall_fscore_support(y_true, y_pred)
+        precision, recall, f_score, support = precision_recall_fscore_support(y_true, y_pred,
+                                                                              zero_division=0)
         auroc = roc_auc_score(y_true, y_pred)
 
         return {'Precision_Smooth': precision[0], 'Precision_Troubled': precision[1],
-- 
GitLab