Home > Software engineering >  Writing custom loss in tensorflow that does not use Y_pred and Y_actual
Writing custom loss in tensorflow that does not use Y_pred and Y_actual

Time:05-15

My loss function for a DNN classification task is eigenvalue-based which does not need the inputs Y_prediction and Y_actual. Is it possible to write specialized custom loss functions like that using Tensorflow?

CodePudding user response:

Of course:

def customLoss(y_true, y_pred, alpha):
               loss = ....alpha
                return loss
model.compile(loss=customLoss(alpha), optimizer='sgd')
  • Related