I have a binary classification problem, where there are multiple correct predictions, however, I would consider the prediction to be correct if the highest confidence prediction of a 1 is correct.

I have had limited success with a CNN using the Hinge loss function. I think the reason is that, this loss function is calculating the loss between every element in y_true and y_pred.


I want my model to confidently predict one of these cells as a 1. There probably isn't enough information in the input data to accurate predict every 1, especially in the areas far from input cells with a positive value, therefore I would be happy if the model is conservative and predicts a 0 where it is unsure.


enter image description here


enter image description here

I believe the model is being optimized to classify as many cells correctly as possible.

It's not possible to correctly predict the cell in the bottom right corner in this example. Therefore the model should take the conservative approach and predict a 0.


enter image description here

A perfect loss function in my mind would:

  • Heavily penalize the case where (y_true, y_pred) = (0,1) (false positive)

  • Heavily reward the case where (y_true, y_pred) = (1,1) (true

  • Moderately penalize the cases where (y_true, y_pred) = (1,0) (false

  • Moderately reward the cases where (y_true, y_pred) = (0,0) (true


Calculate the loss only on the cell with the highest value in y_pred Can anybody suggest a suitable loss function?

Let me know if I have omitted any required detail



You must log in to answer this question.