3

I would like to know how to add in custom weights for the loss function in a binary or multiclass classifier in Keras. I am using binary_crossentropy or sparse_categorical_crossentropy as the baseline and I want to be able to choose what weight to give incorrect predictions for each class.

AAC
  • 563
  • 1
  • 6
  • 18

1 Answers1

1

For multiple classes one should use not binary but categorical crossentropy.

Consider using custom loss function as described here: Custom loss function in Keras

Poe Dator
  • 4,535
  • 2
  • 14
  • 35