When dealing with a binary classification problem, we can use either logistic loss or hinge loss to train our model, implemented with CrossEntropyLoss() or MarginRankingLoss() respectively, if I don’t misunderstand.
In both cases, we can use the same network, say a single FC to project the inputs to outputs y_est of shape (batch_size, 2), where 2 comes from the binary classification.
For CrossEntropyLoss(), we simply argmax the outputs per sample in a batch to yield our predictions: index 0 and 1 for class label 0 and 1, respectively.
On the other hand, do we do the same for MarginRankingLoss()? The target argument in the function (y in the formula below) should be either 1 or -1 (instead of 1 and 0), can we also argmax and say that index 0 and 1 as -1 and 1, respectively?
loss(x,y)=max(0,−y∗(x1−x2)+margin)
I am also wondering if it is correct to regard x1 and x2 as the y_est[:,0] and y_est[:,1].