PacktPublishing / Hands-On-Intelligent-Agents-with-OpenAI-Gym

Code for Hands On Intelligent Agents with OpenAI Gym book to get started and learn to build deep reinforcement learning agents using PyTorch
https://www.packtpub.com/big-data-and-business-intelligence/hands-intelligent-agents-openai-gym
MIT License
366 stars 149 forks source link

ERROR in Class Q_Learner #2

Closed ghost closed 6 years ago

ghost commented 6 years ago

Following you example , the code keeps throwing error

      1 agent = Q_Learner(env)
----> 2 learned_policy = train(agent, env)

<string> in train(agent, env)

<string> in learn(self, obs, action, reward, next_obs)

IndexError: too many indices for array 

in the line td_target = reward + self.gamma * np.max(self.Q[discretized_next_obs])