Skip to content

A Deep Q-Network (DQN) agent solving the CartPole-v1 environment from OpenAI's Gym. Demonstrates reinforcement learning for control tasks and serves as an educational resource for deep learning and reinforcement learning enthusiasts.

Notifications You must be signed in to change notification settings

SeeknnDestroy/DQN-CartPole

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Deep Q-Network (DQN) for CartPole

Overview

This project demonstrates the implementation of a Deep Q-Network (DQN) to solve the CartPole-v1 environment from OpenAI Gym. By using reinforcement learning and PyTorch, this project showcases a deep understanding of machine learning techniques and their applications.

Table of Contents

Technologies Used

  • PyTorch
  • OpenAI Gym

Problem Statement

The goal of this project is to train a DQN agent to balance a pole on a cart for as long as possible. This classic control problem serves as a benchmark to evaluate the performance of reinforcement learning algorithms.

Solution Approach

The solution uses a DQN agent with experience replay and target network. The key components of the project are:

  • Q-Network: A neural network that approximates the action-value function.
  • Replay Buffer: A data structure to store and sample past experiences for training.
  • DQNAgent: A class that defines the agent's behavior, including action selection and learning.

The agent is trained using a variant of the Q-learning algorithm that incorporates deep learning for function approximation.

Results

Agent Performance

The trained agent achieved an average reward of 185.08 over 100 test episodes, demonstrating its ability to effectively solve the CartPole-v1 environment.

Dependencies and Requirements

  • PyTorch
  • OpenAI Gym

Instructions for Running the Code

  1. Clone the repository.
  2. Install the required dependencies.
  3. Run the cells in the jupyter notebook: dql-carpole.ipynb

Feel free to explore and use this project as a starting point for further experimentation with reinforcement learning algorithms and their applications.

About

A Deep Q-Network (DQN) agent solving the CartPole-v1 environment from OpenAI's Gym. Demonstrates reinforcement learning for control tasks and serves as an educational resource for deep learning and reinforcement learning enthusiasts.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published