MoHR icon indicating copy to clipboard operation
MoHR copied to clipboard

ValueError: 'a' must be 1-dimensional or an integer

Open NilSagor opened this issue 5 years ago • 1 comments

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

NilSagor avatar Jan 06 '20 10:01 NilSagor

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.

rrowaida avatar Apr 25 '20 12:04 rrowaida