How to implement my own weighted loss function in Keras?

mariOn report abuse

Hi, forum. I would like to know how to add custom weights for the loss function in a binary or multiclass classifier in Keras. I am using binarycrossentropy or sparsecategorical_crossentropy, based on my model. And I want to be able to choose what weight to give incorrect predictions for each class.


CarlosCV report abuse

Basically, you can't change only weights of built-in Keras loss function. But you can create your own fully custom loss instead! Check this links:

I hope these links will help you to go through that

Add Answer

Need support?

Just drop us an email to ... Show more