Here i put my implemention of reinforcement learning based solutions for the frozenlake game.
- install required packages with
pip install -r requirement.txt
q learning is a model-free off-policy reinforcement learning algorithm.
- training q table : first uncomment this line in the main.py
qlearning.train(episode_number, max_steps, alpha, gamma, epsilon, decay_rate, render_mode, desc)
then run main.py
python main.py
it takes few minutes because it is training the q-table using qlearning.py
Sarsa is a model-free on-policy reinforcement learning algorithm.
- training q table : same as the q-learning first uncomment this line in the main.py
Sarsa.train(episode_number, max_steps, alpha, gamma, epsilon, decay_rate, render_mode)
then run main.py
python main.py
it also takes few minutes because it is training the q-table using Sarsa.py
we can also use Monte-Carlo method for solving it.
- training q table : same as the two last approach uncomment this line in the main.py
Monte_Carlo.train(episode_number, max_steps, epsilon, decay_rate, render_mode)
then run main.py
python main.py
it also takes few minutes because it is training the q-table using Monte_Carlo.py
as training runs 100000 episode of the game its not wise to visualize all of them during the training, in order to do so set the render mode to rgb_array in the main.py
render_mode = "rgb_array"
but if you want to see what happen set it to human
render_mode = "human"