This repository contains the code and implementation for training a Lunar Lander agent using the Deep Q-Network (DQN) reinforcement learning algorithm. The agent learns to control a lunar lander to safely land on the moon's surface by deciding between four possible actions: do nothing, fire the right engine, fire the left engine, or fire the main engine.
Before you begin, make sure you have the following installed:
- Python (3.6+)
- Gym (OpenAI's Gym)
- NumPy
- TensorFlow (or any other deep learning framework of your choice)
You can install these dependencies using pip:
pip install gym numpy tensorflow
- Clone this repository:
git clone https://github.com/yourusername/lunar-lander.git
cd lunar-lander
- Train the DQN agent
This will start the training process for the Lunar Lander using the Deep Q-Network algorithm. You can adjust the hyperparameters in the
lunar_lander.ipynb
file to experiment with different settings.
-
Watch the agent in action This will load the trained model and run the agent in the environment, displaying its performance.
-
Save a video of the agent's performance This will save a video file of the agent's landing attempts.
You can modify the training parameters in the lunar_lander.ipynb
file. This includes settings such as the learning rate, discount factor, and the number of training episodes.
utils.py
: Notebook containing helper functions.lunar_lander_model.h5
: Deep Q-Network model.lunar_lander.mp4
: mp4 video for the test result.lunar_lander.ipynb
: Notebook containing the main code.
You can find the trained model weights and the saved video in the main
directory.
This project is licensed under the MIT License - see the LICENSE file for details.
- This project was inspired by the OpenAI Gym's Lunar Lander environment.
- Special thanks to the online reinforcement learning community for valuable insights and resources.
Feel free to contribute to this project or use it as a starting point for your own reinforcement learning experiments. Happy landing! 🚀🌕