Skip to content
Snippets Groups Projects
Commit c3855055 authored by Nikolai's avatar Nikolai
Browse files

(hopefully) correct treatment of class_weight

parent 4c64d916
No related branches found
No related tags found
No related merge requests found
...@@ -811,8 +811,9 @@ class ClassificationProject(object): ...@@ -811,8 +811,9 @@ class ClassificationProject(object):
self.y_train.reshape(-1, 1), self.y_train.reshape(-1, 1),
epochs=epochs, epochs=epochs,
validation_split = self.validation_split, validation_split = self.validation_split,
class_weight=self.class_weight, # we have to multiply by class weight since keras ignores class weight if sample weight is given
sample_weight=self.w_train, # see https://github.com/keras-team/keras/issues/497
sample_weight=self.w_train*np.array(self.class_weight)[self.y_train.astype(int)],
shuffle=True, shuffle=True,
batch_size=self.batch_size, batch_size=self.batch_size,
callbacks=self.callbacks_list) callbacks=self.callbacks_list)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment