miroblog / deep_rl_trader

Trading Environment(OpenAI Gym) + DDQN (Keras-RL)
403 stars 92 forks source link

Traceback: DQN expects a model that has one dimension for each action, in this case 3. #16

Open dlemosmartins opened 3 years ago

dlemosmartins commented 3 years ago

Making all the changes to the PIP code to run, this is not the first time this error has occurred:

Traceback (most recent call last): File "y:/python_udemy/deep_rl_trader-master/deep_rl_trader/ddqn_rl_trader.py", line 80, in main() File "y:/python_udemy/deep_rl_trader-master/deep_rl_trader/ddqn_rl_trader.py", line 59, in main processor=NormalizerProcessor()) File "C:\Users\danilo.martins\Anaconda3\lib\site-packages\rl\agents\dqn.py", line 111, in init raise ValueError('Model output "{}" has invalid shape. DQN expects a model that has one dimension for each action, in this case {}.'.format(model.output, self.nb_actions)) ValueError: Model output "Tensor("dense_2/BiasAdd:0", shape=(?, 3), dtype=float32)" has invalid shape. DQN expects a model that has one dimension for each action, in this case 3.

What am I doing wrong, you know? That's what I just tried to give the RUN to see how it would work here.

puke3615 commented 1 year ago

I think you need set your model output layer's shape from (None, 3) to (None, 1).

jacobbondy commented 3 months ago

Did you ever find the solution? Currently struggling with this