I would like to create a custom loss function that has a weight coefficient that is updated depending on which era I am in.
For example: Let's say I have a loss function that has a beta weight, where beta increases during the first 20 eras ...
def custom_loss(x, x_pred): loss1 = objectives.binary_crossentropy(x, x_pred) loss2 = objectives.mse(x, x_pred) return (beta*current_epoch/20) * loss1 + loss2
How could I implement something like this in the keras loss function?
source share