1:调用负样本采样函数进行负采样。
def _neg_sampling(self, inter_feat):
inter_feat参数值为:
The batch_size of interaction: 2048
user_id, torch.Size([2048]), cpu, torch.int64
item_id, torch.Size([2048]), cpu, torch.int64
rating, torch.Size([2048]), cpu, torch.float32
timestamp, torch.Size([2048]), cpu, torch.float32
2:根据用户名和负样本个数进行负采样。
def sample_by_user_ids(self, user_ids, num):
3:每个用户会有自己购买商品的ID集合,生成的负样本商品ID每个用户对应得不能在已