sberbank-ai-lab / RePlay

RecSys Library
https://sberbank-ai-lab.github.io/RePlay/
Apache License 2.0
63 stars 6 forks source link

NeuroMF bug #99

Open monkey0head opened 2 years ago

monkey0head commented 2 years ago

After indexing change negative generation for NeuroMF got a bug. Before: negatives were sampled from [0, num_items) uniform distribution; for now it is from [0, max_item + 1) distribution. Ids were consecutive before and now they are not, so we can sample absent ids, which can break a training or make it less efficient. Here:

    def _get_neg_batch(self, batch: Tensor) -> Tensor:
        negative_items = torch.randint(
            0,
            self._item_dim,
            (batch.shape[0] * self.count_negative_sample,),
        )
        return negative_items
monkey0head commented 2 years ago