GRU4Rec icon indicating copy to clipboard operation
GRU4Rec copied to clipboard

BPR loss implementation question

Open msemikin opened this issue 7 years ago • 0 comments

Hi, I have a question about the mini-batch sampled BPR loss. The code is as follows:

def bpr(self, yhat, M):
    return T.cast(T.mean(-T.log(T.nnet.sigmoid(gpu_diag_wide(yhat).dimshuffle((0, 'x'))-yhat))), theano.config.floatX)

Do I understand correctly, that the score for the positive item is also considered as one of the negative scores? Positive score is not filtered from the negative scores list. Sigmoid of 0 difference between positive and negative here will be 0.5 and negative log contribution to loss will be 0.7 from the positive score itself.

msemikin avatar Mar 24 '19 17:03 msemikin