From 4ac1c6b5b2456b56fe4dfefb869c1325de1f1e3d Mon Sep 17 00:00:00 2001
From: Nikolai <osterei33@gmx.de>
Date: Thu, 16 Aug 2018 09:51:08 +0200
Subject: [PATCH] normalize weights for default training as well

---
 toolkit.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/toolkit.py b/toolkit.py
index e424460..e912881 100755
--- a/toolkit.py
+++ b/toolkit.py
@@ -828,7 +828,7 @@ class ClassificationProject(object):
                                validation_split = self.validation_split,
                                # we have to multiply by class weight since keras ignores class weight if sample weight is given
                                # see https://github.com/keras-team/keras/issues/497
-                               sample_weight=self.w_train*np.array(self.class_weight)[self.y_train.astype(int)],
+                               sample_weight=self.w_train*np.array(self.class_weight)[self.y_train.astype(int)]/self.mean_train_weight,
                                shuffle=True,
                                batch_size=self.batch_size,
                                callbacks=self.callbacks_list)
-- 
GitLab