machine-learning-for-trading
machine-learning-for-trading copied to clipboard
04_q_learning_for_trading -> experience_replay(self) --> predict q values gives shape mismatch error
Error:
This line of code:
q_values[[self.idx, actions]] = targets
Gives an error:
Exception has occurred: ValueError
shape mismatch: value array of shape (4096,) could not be broadcast to indexing result of shape (2,4096,3)

Steps to reproduce:
run 04_q_learning_for_trading.ipynb
Environment:
python 3.9
I found by replacing line 123 with :
for i in self.idx:
action = actions[i]
q_values[self.idx][action] = targets[i]
the training works!