I am attempting to create a Q table following this blog post that I found on Medium.com. In my step function (python class) for creating a custom open AI Gym environment, my action space self.action_space
would be 3 possible actions and the possible observations would be a values 50 to 150 in increments of 1 self.observation_space
.
#possible actions from more_heat less heat functions
self.action_space = np.array([ 0, 1, 2])
#possible deviation values from temp - setpoint
self.observation_space = np.arange(50,150,1)
The blog post that I am following creates the Q table by this code below which I think is just creating an array of zeros based on the sizes.
action_size = env.action_space.n
state_size = env.observation_space.n
qtable = np.zeros((state_size, action_size))
print(qtable)
But when I attempt to print the Q table, I get this error:
TypeError: only integer scalar arrays can be converted to a scalar index
Any words from the wise on what I am doing wrong would be greatly appreciated!
Same error just running this code:
import numpy as np
action_space = np.array([0,1,2])
observation_space = np.arange(50,150,1)
action_size = action_space
state_size = observation_space
qtable = np.zeros((state_size, action_size))
print(qtable)