April 2018
Intermediate to advanced
334 pages
10h 18m
English
Now, let's try to program a reinforcement learning agent using Q-learning. Q-learning consists of a Q-table that contains Q-values for each state-action pair. The number of rows in the table is equal to the number of states in the environment and the number of columns equals the number of actions. Since the number of states is 16 and the number of actions is 4, the Q-table for this environment consists of 16 rows and 4 columns. The code for it is given here:
print("Number of actions : ",env.action_space.n)print("Number of states : ",env.observation_space.n)----------------------Number of actions : 4 Number of states : 16
The steps involved in Q-learning are as follows: