2

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
  • 493
  • 1
  • 5
  • 16

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
  • 3,779
  • 2
  • 11
  • 31