maciejkula / triplet_recommendations_keras

An example of doing MovieLens recommendations using triplet loss in Keras
Apache License 2.0
421 stars 104 forks source link

Please,I have a problem with your function "bpr_triplet_loss"... #13

Open zhhengcs opened 6 years ago

zhhengcs commented 6 years ago

I saw you have use "K.sum(user_latent positive_item_latent, axis=-1, keepdims=True)",but in my keras with tensorflow backend,this "" means point-wise multiplication. I think we should compute the cos similarity between user and pos-items,so why Why don't we use "K.batch_dot(K.l2_normalize(x,axis = -1),K.l2_normalize(y,axis=-1))"? Thank you for your answer and help!

maciejkula commented 6 years ago

For BPR we want dot products, not cosine similarity (at least it's defined that way in the paper).

K.batch_dot may still be useful, though.