machine-learning-for-trading
machine-learning-for-trading copied to clipboard
shape mismatch: value array of shape (4096,) could not be broadcast to indexing result of shape (2,4096,3)
Trying to run 04_q_learning_for_trading results in the following error:
118 print(targets.shape)
119 print(targets)
--> 120 q_values[[self.idx, actions]] = targets 122 loss = self.online_network.train_on_batch(x=states, y=q_values) 123 self.losses.append(loss)
ValueError: shape mismatch: value array of shape (4096,) could not be broadcast to indexing result of shape (2,4096,3)
Running tensorflow 2.9.2 (GPU)
Same here... have you found a solution?
Same issue
I changed the line in the error message to this:q_values[self.idx, actions] = targets
So far it seems to be working for me.
There have been several updates to the open AI gym since publication. Please either use the version that was current at publication (around 2020/06) or update the code accordingly.
https://www.facebook.com/mxalgrito?mibextid=ZbWKwL IP??
El sáb., 30 de julio de 2022 10:17, defc0n1 @.***> escribió:
Trying to run 04_q_learning_for_trading results in the following error:
118 print(targets.shape) 119 print(targets)
--> 120 q_values[[self.idx, actions]] = targets 122 loss = self.online_network.train_on_batch(x=states, y=q_values) 123 self.losses.append(loss)
ValueError: shape mismatch: value array of shape (4096,) could not be broadcast to indexing result of shape (2,4096,3)
Running tensorflow 2.9.2 (GPU)
— Reply to this email directly, view it on GitHub https://github.com/stefan-jansen/machine-learning-for-trading/issues/251, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATHPZIMC37NLIGZ2L2OGNUTVWVPR5ANCNFSM55DQP4LA . You are receiving this because you are subscribed to this thread.Message ID: @.***>