tffm
tffm copied to clipboard
Support for Bayesian Personalized Ranking
Hi there, I'm thinking of contributing codes for BPR. What is the best way to extend the code to handle this optimization in your opinion?
Hi @jerry-rubikloud ! I think that we need to implement 2 components:
- BPRSampler. It will generate pairs from source data and put them into batch. Example: for N pairs we will have a batch with N*2 samples (
2 * i
-th are winners,2 * i + 1
-th are losers) - BRPLoss. It will take expanded batch output ([2*N, 1]), convert it to pairs ([N, 2]) and calculate resulting loss. This design seems to be easy for implementation and allows to keep FM core routine unchanged