Skip to content

Myk72/RL-Algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

RL Algorithms Project

This repository contains implementations of Reinforcement Learning (RL) algorithms. I implemented two agents to solve the CartPole environment and compared their learning behaviors. I also completed a task using Prioritized Experience Replay (PER) on LunarLander-v2.

Features

1. Q-Learning Agent

  • Implemented a classic Q-Learning agent.
  • Uses a Q-table for value storage.
  • Applies state discretization using bins to handle continuous observations.

2. DQN Agent

  • Implemented a Deep Q-Network (DQN) using PyTorch.
  • Uses a neural network to approximate Q-values.
  • Includes Experience Replay and a Target Network for improved learning stability.

3. Comparison

  • Trained both Q-Learning and DQN agents.
  • Created plots showing average reward and learning curves.
  • Compared stability, speed, and performance of both algorithms.

4. Additional Task: PER

  • Implemented Prioritized Experience Replay (PER).
  • Trained PER-based agent on the LunarLander-v2 environment.

Folder Structure

RL_Algorithm/
β”‚
β”œβ”€β”€ DQN/
β”‚   β”œβ”€β”€ dqn.ipynb                 # Code for the DQN agent
β”‚   β”œβ”€β”€ dqn_learning_curve.png    # Plot for DQN training
β”‚   β”œβ”€β”€ dqn_model.pth             # Saved model file
β”‚   └── final_comparison_plot.png # Plot comparing DQN vs Q-Learning
β”‚
β”œβ”€β”€ PER/
β”‚   └── per.ipynb                 # PER on LunarLander-v3
β”‚
β”œβ”€β”€ Q_Learning/
β”‚   β”œβ”€β”€ Q_Learning.ipynb          # Code for the Q-Learning agent
β”‚   β”œβ”€β”€ q_table.npy               # Saved Q-Table file
β”‚   β”œβ”€β”€ learning_curve.png        # Plot for Q-Learning training
β”‚   β”œβ”€β”€ rewards_log.npy           # Data file for rewards
β”‚   └── avg_rewards_log.npy       # Data file for average rewards
β”‚
└── README.md

About

This project implements two AI agents that learn to solve the Cart-Pole game. It also includes an agent learns to play the Lunar-Lander game using Prioritized Experience Replay (PER).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors