guoyang9 / NFM-pyorch

A pytorch implementation for He et al. Neural Factorization Machines for Sparse Predictive Analytics on SIGIR 2017.
38 stars 11 forks source link

turn to pair-wise ranking issue #2

Closed AmazingDD closed 5 years ago

AmazingDD commented 5 years ago

this NFM implementation is really good, how can I turn this rating prediction method to a pair-wise ranking issue just like the BPR-torch repo u did before? where should I change the code? loss function or other parts?

Thx.

guoyang9 commented 5 years ago

I don't think pair-wise learning trick under NFM makes much sense. For example, for a positive instance (e.g., <user, item, item category>, you cannot say another negative sampled instance's item category is less relevant than the positive one (because this user may have interaction with this item category).

If you truly want to try the pair-wise learning trick, do maintain a dictionary in data_utils.py for negative sampling in every epoch. Besides, the input instance should be two in this case (positive and negative). As for the loss function, you can refer to my another BPR repo it's similar.