Is there a way or technique to add a "correct-no-matter-what" label?

So when calculating losses, I want to have a label such that, no matter what the prediction I make, it is always correct, e.t. loss is always zero for this label. Basically it’s like a placeholder. All other labels will be handled in the normal way, in which the loss is calculated based on how correct it is. For 1 specific label, I want to it to yield a loss of 0, all the time. Is there a way to do this in mxnet? Thank you very much!

All losses accept weight as a parameter. You can set the the weight of the loss to 0.

Please check:

1 Like

Thanks for responding! If I set the weight, then all the losses computed by this loss function will be 0, correct? This is not what I want. For example, the correct label is [1, 2, 3, 4, 5], where 1 is the magical label that no matter what the prediction is, the loss is always 0. So if I have predictions like [2, 2, 3, 4, 5] or [1, 2, 3, 4, 5] or [3, 2, 3, 4, 5], they are all correct predictions. Is there a way to do this? Thank you very much!

You can do element-wise weight masking, that means, the mask of the loss is [0, 1, 1, 1, 1] in your particular case. So it’s only masking out the first prediction being whatever it is, no penalty is posted.

1 Like

Thank you! I’ll try this and update.