Basic Python implementation of Tabular Q-Learning working with OpenAI-Gym
- Python 3
- OpenAI-Gym
- NumPy
This implementation if of a Tabular Q-Learning, in order to change the Environment, make sure it is compatible. This means it must have a discrete state/observation space and a discrete action space. In order to choose a different Environment, simply change the following "Taxi-v2" to the name of the environment you'd like to test.
env = gym.make("Taxi-v2")
To change the parameters for learning rate, discount factor and episodes, respectively, change these lines:
lr = 0.6
gamma = 1.0
MAX_EPISODES = 1001
For learning purposes I encourage you to test different parameters and compare performances.
Medium Tutorial, Arthur Juliani
Reinforcement Learning: An Introduction, Sutton and Barto - Amazing book on the basis for Reinforcement Learning