MoHR
MoHR copied to clipboard
ValueError: 'a' must be 1-dimensional or an integer
In sampler.py , line 61, in sample_ii r = invRelationships[np.random.choice(Item[i]['related'].keys(), 1)[0]]
ValueError: 'a' must be 1-dimensional or an integer
Here np.random.choice(Item[i]['related'].keys(), 1), expect either an integer, or a 1-dimentional array. But Item[i]['related'].keys() is a dist() list. So the solution which worked for me is as below:
r_temp1 = list(Item[i]['related'].keys()) r_temp2 = np.random.choice(len(Item[i]['related'].keys()), 1) r_temp = r_temp1[r_temp2[0]] r = invRelationships[r_temp]
Hope it works for you.