maciejkula/spotlight

"Only integer scalar arrays can be converted to a scalar index"

pugantsov opened this issue · 1 comments

When I add timestamps to my interactions matrix, which builds completely fine, I get this:

Traceback (most recent call last):
  File "model_spotlight.py", line 105, in <module>
    sim.run()
  File "model_spotlight.py", line 96, in run
    train, test = self.cross_validation(implicit_interactions)
  File "model_spotlight.py", line 64, in cross_validation
    train, test = random_train_test_split(interactions)
  File "/home/alex/anaconda3/envs/recsys/lib/python3.6/site-packages/spotlight/cross_validation.py", line 83, in random_train_test_split
    random_state=random_state)
  File "/home/alex/anaconda3/envs/recsys/lib/python3.6/site-packages/spotlight/cross_validation.py", line 51, in shuffle_interactions
    shuffle_indices),
  File "/home/alex/anaconda3/envs/recsys/lib/python3.6/site-packages/spotlight/cross_validation.py", line 17, in _index_or_none
    return array[shuffle_index]
TypeError: only integer scalar arrays can be converted to a scalar index

Just realised this is because I tried to pass a list which wasn't cast as an np.array, as a warning to whoever else is getting this.