machine-learning-for-trading icon indicating copy to clipboard operation
machine-learning-for-trading copied to clipboard

04_q_learning_for_trading -> experience_replay(self) --> predict q values gives shape mismatch error

Open yeonmo317 opened this issue 2 years ago • 1 comments

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) bug reported v2

Steps to reproduce:

run 04_q_learning_for_trading.ipynb

Environment:

python 3.9

yeonmo317 avatar Apr 05 '23 09:04 yeonmo317

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!

Frxljord avatar Jun 29 '23 16:06 Frxljord