Hello,
I have an array "theanoYsamplecount" that is initialized to all zeros. Then
I choose the largest entry of some matrix of the same dimension and
increment that entry by 1 in theanoYsamplecount. I do this in the scan
function "chooseEntries". However, when I check the numpy results, so I
evaluate the indices and the final theanoYsamplecount things don't match up
(as in theanoYsamplecount.eval() will be 0 at the entries for which it
should have been incremented to 1). Any help would be very much appreciated!
Thanks,
Annie
def chooseEntries(n, theanoYsamplecount, max_index, max_value,
y_predicted_scan):
Rewards=T.flatten(y_predicted_scan.T)*T.pow(beta,theanoYsamplecount)
[max_value, max_index]=T.max_and_argmax(Rewards)
theanoYsamplecount = T.inc_subtensor(theanoYsamplecount[max_index], 1)
return [theanoYsamplecount, max_index, max_value]
[sample_count, obs_indices, estimate_ratings],
updates=theano.scan(fn=chooseEntries,
sequences=T.arange(Nobs),
outputs_info=[theanoYsamplecount,dict(initial= np.int64(0) ,taps=[-1]),
dict(initial= np.float64(0) ,taps=[-1])],
non_sequences=[y_predicted_scan])
numpy_obs_indices=obs_indices.eval()
numpy_estimated_ratings=estimate_ratings.eval()
Ysamplecount=sample_count[-1].eval()
print('INDICES')
print(numpy_obs_indices)
print('Ysamplecount')
print(Ysamplecount)
print("Match?")
print(Ysamplecount[numpy_obs_indices])
--
---
You received this message because you are subscribed to the Google Groups
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.