IndexError: @ random.choice(self.data[u].indices)
HongxuChenUQ opened this issue · 1 comments
sampling 9993 <user,item i,item j> triples...
Traceback (most recent call last):
File "testTopK.py", line 283, in
model.train(data,sampler,num_iters)
File "testTopK.py", line 46, in train
self.init(data)
File "testTopK.py", line 63, in init
self.create_loss_samples()
File "testTopK.py", line 71, in create_loss_samples
self.loss_samples = [t for t in sampler.generate_samples(data,num_loss_samples)]
File "testTopK.py", line 173, in generate_samples
j = self.sample_negative_item(self.data[u].indices)
File "testTopK.py", line 139, in sample_negative_item
j = self.random_item()
File "testTopK.py", line 154, in random_item
i = random.choice(self.data[u].indices)
File "/usr/lib64/python2.7/random.py", line 274, in choice
return seq[int(self.random() * len(seq))] # raises IndexError if seq is empty
IndexError: index 0 is out of bounds for axis 0 with size 0
Solved!