Is the argument "-num_negative" effective?
JonathanChen1002 opened this issue · 3 comments
JonathanChen1002 commented
Hi, I would like to ask several questions about negative sampling:
- I found the argument "-num_negative" while running tpr, but I couldn't find any reference in the code. Is it effective while training?
- If I want to change the weight of negative sampling, what is simplest way to implement?
Thank you
chihming commented
Hi,
- I just update the code making it work: https://github.com/cnclabs/codes.tpr.rec/blob/master/hub/tpr.cpp#L81
- please try to modify this: https://github.com/cnclabs/codes.tpr.rec/blob/master/src/sampler/vc_sampler.cpp#L39
thenegative_sampler
can be used for negative sampling
JonathanChen1002 commented
In my understanding, current training procedure is:
- draw a user and relative item i
- draw another positive item j and relative word w (by item i)
- uniformly draw a item j' and corresponding relative word w' as negative pair
- update embedding for j, j', w, w'
- repeat 2~4 five(-num_negative) times
- update embedding for u, i
If I want to change the weight of negative sampling, I think I need to feed the weight into negative_sampler, and call draw_a_negative in tpr.cpp. Am I correct?
chihming commented
yes, it seems no problem