Traceback (most recent call last):
File "test.py", line 9, in <module>
print(vmo.generate.improvise(p, 15))
File "/home/jcelerier/score/base/addons/score-addon-vmo/3rdparty/vmo/vmo/generate.py", line 87, in improvise
s.append(improvise_step(oracle, k, LRS, weight))
File "/home/jcelerier/score/base/addons/score-addon-vmo/3rdparty/vmo/vmo/generate.py", line 47, in improvise_step
trn_link = [s + 1 for s in oracle.latent[oracle.data[i]] if
TypeError: only integer scalar arrays can be converted to a scalar index
I changed the function to the following to make it work (just a cast to int for the oracle data sequence):
latent = oracle.latent[int(oracle.data[i])]
if prune:
prune_list = range(i % prune, oracle.n_states - 1, prune)
trn_link = [s + 1 for s in latent if
(oracle.lrs[s] >= lrs and
(s + 1) < oracle.n_states) and
s in prune_list]
else:
trn_link = [s + 1 for s in latent if
(oracle.lrs[s] >= lrs and (s + 1) < oracle.n_states)]
if not trn_link:
if i == oracle.n_states - 1:
n = 1
else:
n = i + 1
else:
if weight == 'lrs':
lrs_link = [oracle.lrs[s] for s in latent if
(oracle.lrs[s] >= lrs and (s + 1) < oracle.n_states)]
lrs_pop = list(itertools.chain.from_iterable(itertools.chain.from_iterable(
[[[i] * _x for (i, _x) in zip(trn_link, lrs_link)]])))
n = np.random.choice(lrs_pop)
else:
n = trn_link[int(np.floor(random.random() * len(trn_link)))]
return n
Given
I get
I changed the function to the following to make it work (just a cast to int for the oracle data sequence):