In this project, using a Unity ML-Agents environment you will train an agent to navigate (and collect bananas!) in a large, square world via DQN, Double DQN and Dueling algorithms.
A reward of +1 is provided for collecting a yellow banana, and a reward of -1 is provided for collecting a blue banana. Thus, the goal of your agent is to collect as many yellow bananas as possible while avoiding blue bananas.
The state space has 37 dimensions and contains the agent's velocity, along with ray-based perception of objects around agent's forward direction. Given this information, the agent has to learn how to best select actions. Four discrete actions are available, corresponding to:
0
- move forward.1
- move backward.2
- turn left.3
- turn right.
The task is episodic, and in order to solve the environment, your agent must get an average score of +13 over 100 consecutive episodes.
- Python 3.6
- PyTorch 0.4.0
- ML-Agents Beta v0.4
NOTE : (For Windows users) The ML-Agents toolkit supports Windows 10. While it might be possible to run the ML-Agents toolkit using other versions of Windows, it has not been tested on other versions. Furthermore, the ML-Agents toolkit has not been tested on a Windows VM such as Bootcamp or Parallels.
-
Create (and activate) a new environment with Python 3.6 via Anaconda.
- Linux or Mac:
conda create --name your_env_name python=3.6 source activate your_env_name
- Windows:
conda create --name your_env_name python=3.6 activate your_env_name
-
Clone the repository, and navigate to the python/ folder. Then, install several dependencies (see
requirements.txt
).git clone https://github.com/4kasha/Navigation_DQN.git cd Navigation_DQN/python pip install .
-
Download the Unity environment from one of the links below. You need only select the environment that matches your operating system:
- Linux: click here
- Mac OSX: click here
- Windows (32-bit): click here
- Windows (64-bit): click here
(For AWS) If you'd like to train the agent on AWS (and have not enabled a virtual screen), then please use this link to obtain the environment.
NOTE : For this project, you will not need to install Unity. The link above provides you a standalone version. Also the above Banana environment is similar to, but not identical to the Banana Collector environment on the Unity ML-Agents GitHub page.
-
Place the file in this repository Navigation_DQN and unzip (or decompress) the file.
- Before running code, change parameters in
train.py
, especially you must changeenv_file_name
according to your environment. - Run the following command to get started with training your own agent!
python train.py
- After finishing training weights and scores are saved in the following folder
weights
andscores
respectively.
- For more details of algolithm description, hyperparameters settings and results, see Report.md.
- For the examples of training results, see Navigation_Results_Example.ipynb.
- After training you can test the agent with saved weights in the folder
weights
, see Navigation_Watch_Agent.ipynb. - This project is a part of Udacity's Deep Reinforcement Nanodegree program.