I'm learning about various loss functions used in Deep learning. I needed some help implementing a custom loss function in tensorflow. To get a concrete picture of this, I would like to implement a custom Binary Cross Entropy loss as an example.
Thanks a lot for your help
Regards
Edit: The following is loss function I have implemented:
def custom_loss(eps):
def loss(y_true, y_pred):
ans = -eps*(y_true*tf.log(y_pred) + (1-y_true)*tf.log(y_pred))
return ans
return loss
This is returning not a number after sometime. I tried to add a small quantity to the log function. Furthermore, I have changed the optimiser to adam.