3
votes

I am having a problem at hand which optimizes a loss function that is not a function of y_pred and y_true . After going through the Keras documentation , I found out that all the custom loss functions must be a function of both y_pred and y_true.

Is there any alternate way of implementing my kind of loss function in Keras?

1
What is your loss function a function of then?Primusa
You can define a function(y_true,y_pred) and simply not use them. But well... does it make any sense to not use y_pred in the loss function?Daniel Möller

1 Answers

1
votes

No.This is the flaw of keras. If you want to use that type of loss function, then the basic stochastic gradient descent scheme won't work.Many concepts such as batch size will disappear and that will be a substantive change so keras does not allow you to do so.