THUDM/ComiRec

关于sampled softmax的一个问题

ZHANSHANJUN opened this issue · 4 comments

hi~,请问你们num_sampled这个参数的值为什么设置成这个 self.neg_num * self.batch_size ,为什么带上batch_size

Hi @zhan007,

Thank you for your interest in our work. In our code, we set neg_num=10 which means each training sample corresponds to 10 negative samples. From the official documents of TensorFlow, we can see that the meaning of num_sampled is the number of classes to randomly sample per batch. Therefore, we need to pass a total number of negative samples for a batch to the num_sampled.

Thanks~ I used it wrong before...

tensorflow中,tf.nn.sampled_softmax_loss()函数的实现中,num_sampled参数表示负采样数。但是每条正样本共用这num_sampled条负样本,将这个参数和batch_size关联似乎不妥。

tensorflow中,tf.nn.sampled_softmax_loss()函数的实现中,num_sampled参数表示负采样数。但是每条正样本共用这num_sampled条负样本,将这个参数和batch_size关联似乎不妥。

Thank you for your suggestions. It seems that we can just set the num_sampled as a large value, e.g., 1000.