Skip to content

Instantly share code, notes, and snippets.

@BalazsHoranyi BalazsHoranyi/bpr_loss.py

Last active Apr 17, 2018
Embed
What would you like to do?
BPR
def bpr_loss(positive_predictions, negative_predictions):
"""
Bayesian Personalised Ranking pairwise loss function. Original Implementation: https://github.com/maciejkula/spotlight
"""
loss = (1.0 - F.sigmoid(positive_predictions -
negative_predictions))
return loss.mean()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.