Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stifler7/rl-for-game-ai
Game Artificial Intelligence with Reinforcement Learning This project provides experience in applying techniques of RL to game artificial intelligence. It shall demonstrate several RL algorithms- specifically Q-learning and deep Q-networks (DQN)- to game environments.
https://github.com/stifler7/rl-for-game-ai
deep-learning deep-neural-networks deep-reinforcement-learning machine-learning
Last synced: 12 days ago
JSON representation
Game Artificial Intelligence with Reinforcement Learning This project provides experience in applying techniques of RL to game artificial intelligence. It shall demonstrate several RL algorithms- specifically Q-learning and deep Q-networks (DQN)- to game environments.
- Host: GitHub
- URL: https://github.com/stifler7/rl-for-game-ai
- Owner: STiFLeR7
- Created: 2024-10-17T05:54:52.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2024-10-17T06:29:58.000Z (4 months ago)
- Last Synced: 2024-12-01T23:33:46.652Z (2 months ago)
- Topics: deep-learning, deep-neural-networks, deep-reinforcement-learning, machine-learning
- Language: Python
- Homepage: https://github.com/STiFLeR7/RL-for-Game-AI
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Deep Q-Learning for CartPole Environment
This project implements a Deep Q-Learning agent to solve the CartPole environment using TensorFlow and PyTorch. The agent learns to balance a pole on a cart by taking actions based on the current state of the environment.
## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [Training](#training)
- [Agent](#agent)
- [Dependencies](#dependencies)## Installation
To set up the project, clone this repository and install the required dependencies:
```bash
git clone https://github.com/STiFLeR7/RL-for-Game-AI.git
cd RL-for-Game-AI
pip install -r requirements.txt
```Make sure to install a compatible version of Gym and its dependencies.
## Usage
1. Ensure you have Python 3.7 or higher installed.
2. Activate your virtual environment (if you're using one).
3. Run the training script:```bash
python train.py
```4. The agent will train over a specified number of episodes and save the model as `dqn_model.pth`.
## Training
You can customize the number of training episodes in the `train_agent` function within the `train.py` script. The default is set to 1000 episodes.
## Agent
The agent uses a Deep Q-Network (DQN) approach to approximate the Q-values for each action based on the current state. It employs experience replay and epsilon-greedy strategy for action selection.
### DQN Architecture
- **Input Layer**: Takes the state representation from the environment.
- **Hidden Layers**: Fully connected layers with ReLU activations.
- **Output Layer**: Outputs Q-values for each possible action.## Dependencies
The following Python packages are required to run this project:
- gym
- numpy
- torch
- tensorflow
- matplotlibYou can install them using pip:
```bash
pip install gym numpy torch tensorflow matplotlib
```
project or raise issues if you encounter any problems.