Skip to content

thinley4/Implementing-Q-learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Frozen Lake Q-Learning (Implementing Q-Learning in code with Python)

A simple Q-learning implementation to solve the FrozenLake environment from OpenAI Gymnasium.

What it does

The agent learns to navigate a frozen lake to reach a goal while avoiding holes using Q-learning reinforcement learning algorithm.

Requirements

pip install numpy gymnasium

How to run

python main.py

Parameters

  • Episodes: 10,000 training episodes
  • Learning rate: 0.1
  • Discount rate: 0.99
  • Exploration rate: Decays from 1.0 to 0.01

Output

initial_q_table

  • Initial Q-table (all zeros)

reward

  • Average reward per 1000 episodes during training

final_q_table

  • Final trained Q-table

The agent starts with random exploration and gradually learns optimal actions through trial and error.

Credits

Code adapted from: DeepLizard Q-Learning Tutorial

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages