Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

as the for bpr loss function, is the expression right in the code? #27

Open
jackyhawk opened this issue Feb 1, 2019 · 4 comments
Open

Comments

@jackyhawk
Copy link

jackyhawk commented Feb 1, 2019

As for the loss function and updating the latent vector(parameter) ,

i find it is different implementment in the code and in the pater

in code:
Double BPREngine::loss(const Double scoreDifference) const {
return log(1.0 + exp(-scoreDifference));
}

in paper:

i just paste the rule here:
http://photo27.hexun.com/p/2019/0201/632421/b_vip_11118BF2E45A1C8033DC6DA3576F7A2C.jpg
http://photo27.hexun.com/p/2019/0201/632421/b_vip_11118BF2E45A1C8033DC6DA3576F7A2C.jpg

you can get the rule here

Θ = Θ + α( e^(-Xuij) / (1+ e ^(-Xuij) )........)

@albietz
Copy link
Contributor

albietz commented Feb 1, 2019

Hi, the function loss just gives you the loss for a given triplet, which in this case is given by the negative log-likelihood according to the BPR model. What you're showing in the image corresponds to gradient updates, which you can find in the BPREngine::update function (see https://github.com/quora/qmf/blob/master/qmf/bpr/BPREngine.cpp#L178).

Hope this helps,
Alberto

@jackyhawk
Copy link
Author

jackyhawk commented Feb 2, 2019

Thanks very much Alberto.

And I just made a mistake, what i want to say is the lossderitive in the training presss,which is
https://github.com/quora/qmf/blob/master/qmf/bpr/BPREngine.cpp#L243
https://github.com/quora/qmf/blob/master/qmf/bpr/BPREngine.cpp#L183

just as you mentioned in the update function.

however the lossDerivative is not the same as the highlight part in the picture:

http://photo27.hexun.com/p/2019/0201/632421/b_vip_11118BF2E45A1C8033DC6DA3576F7A2C.jpg

i wonder whether we should use this expression:

1.0 / (1.0 + exp(scoreDifference))

or this expression:
exp(-scoreDifference) / (1.0 + exp(-scoreDifference)); (and it is the same as: e^(-Xuij) / (1+ e ^(-Xuij) ) )

to calculate the loss deritive?

@albietz
Copy link
Contributor

albietz commented Feb 2, 2019

Those two expressions are in fact equal :)

@jackyhawk
Copy link
Author

Got it, Thanks very much Alberto.

@jackyhawk jackyhawk changed the title as the for bpr loss function, is the expression is right in the code? as the for bpr loss function, is the expression right in the code? Apr 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants