From 108a39437682c3e41e91f4e226f29ee1ed638438 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, 11 Jan 2022 18:40:00 +0100
Subject: [PATCH] Added evaluation for all classes (if the measure allows).

---
 ANN_Training.py | 14 +++++++++-----
 config.yaml     | 13 ++++++++-----
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/ANN_Training.py b/ANN_Training.py
index 2439936..84f0fe3 100644
--- a/ANN_Training.py
+++ b/ANN_Training.py
@@ -8,7 +8,7 @@ TODO: Optimize Snakefile-vs-config relation
 TODO: Improve maximum selection runtime -> Done
 TODO: Change model output to binary -> Do? (changes training when applied in ANN_Model)
 TODO: Adapt TCD file to new classification
-TODO: Add evaluation for all classes (recall, precision, fscore)
+TODO: Add evaluation for all classes (recall, precision, fscore) -> Done
 TODO: Add documentation
 
 """
@@ -129,8 +129,10 @@ class ModelTrainer(object):
         # print(roc)
         # plt.plot(fpr, tpr, label="AUC="+str(auroc))
 
-        return {'Precision': precision[0], 'Recall': recall[0], 'Accuracy': accuracy,
-                'F-Score': f_score[0], 'AUROC': auroc}
+        return {'Precision_Smooth': precision[0], 'Precision_Troubled': precision[1],
+                'Recall_Smooth': recall[0], 'Recall_Troubled': recall[1],
+                'F-Score_Smooth': f_score[0], 'F-Score_Troubled': f_score[1],
+                'Accuracy': accuracy, 'AUROC': auroc}
 
     def save_model(self):
         # Saving Model
@@ -158,8 +160,10 @@ def read_training_data(directory, normalized=True):
 def evaluate_models(models, directory, num_iterations=100, colors=None,
                     compare_normalization=False):
     if colors is None:
-        colors = {'Accuracy': 'red', 'Precision': 'yellow', 'Recall': 'blue',
-                  'F-Score': 'green', 'AUROC': 'purple'}
+        colors = {'Accuracy': 'magenta', 'Precision_Smooth': 'red',
+                  'Precision_Troubled': '#8B0000', 'Recall_Smooth': 'blue',
+                  'Recall_Troubled': '#00008B', 'F-Score_Smooth': 'green',
+                  'F-Score_Troubled': '#006400', 'AUROC': 'yellow'}
 
     datasets = {'normalized': read_training_data(directory)}
     if compare_normalization:
diff --git a/config.yaml b/config.yaml
index 86171ca..b4e2708 100644
--- a/config.yaml
+++ b/config.yaml
@@ -26,11 +26,14 @@ functions:
 # Parameter for Model Training and Evaluation
 compare_normalization: True
 classification_colors:
-  Accuracy: 'magenta'
-  Precision: 'red'
-  Recall: 'tan'
-  F-Score: 'green'
-  AUROC: 'yellow'
+  Accuracy: '#FF00FF'  # magenta
+  Precision_Smooth: '#FF0000'  # red
+  Precision_Troubled: '#8B0000'  # dark red
+  Recall_Smooth: '#0000FF'  # blue
+  Recall_Troubled: '#00008B'  # dark blue
+  F-Score_Smooth: '#00FF00'  # green
+  F-Score_Troubled: '#006400'  # dark green
+  AUROC: '#FFFF00'  # yellow
 models:
   Adam:
     num_epochs: 1000
-- 
GitLab