For this project, you will train an agent to navigate (and collect bananas!) in a large, square world.
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.
This project contains a Jupyter notebook and several Python files.
To set up your python environment to run the code in this repository, follow the instructions below.
-
Create (and activate) a new environment with Python 3.6.
conda create --name drlnd python=3.6 source activate drlnd
-
Clone repository and install python dependencies
git clone REPO_NAME cd REPO_NAME pip install ./python
-
Create an IPython kernel for the
drlnd
environment.python -m ipykernel install --user --name drlnd --display-name "drlnd"
-
Before running code in a notebook, change the kernel to match the
drlnd
environment by using the drop-downKernel
menu.
-
Download the 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 Windows users) Check out [this link](https://support.microsoft.com/en-us/help/827218/ how-to-determine-whether-a-computer-is-running-a-32-bit-version-or-64) if you need help with determining if your computer is running a 32-bit version or 64-bit version of the Windows operating system.
(For AWS) If you'd like to train the agent on AWS (and have not [enabled a virtual screen](https://github.com/ Unity-Technologies/ml-agents/blob/master/docs/Training-on-Amazon-Web-Service.md)), then please use [this link](https:// s3-us-west-1.amazonaws.com/udacity-drlnd/P1/Banana/Banana_Linux_NoVis.zip) to obtain the environment.
-
Place the file in the root of the Github repository's folder (
RLND-Navigation-P1
), and unzip (or decompress) the file.
Navigate to Navigation.ipynb
. You have the options either to
- a) train your own agent based on my model
- b) see my trained agent in action
For a), please execute 1-5. For b), please execute 1-4 and 6.
- Dueling DQN:
agent.py:3 # before from model import QNetwork as QNetwork # after from model import DuelQNetwork as QNetwork
- Double DQN:
agent.py:63 # before self.learn(experiences, GAMMA) # after self.doublelearn(experiences, GAMMA)
- Dueling Double DQN: change both lines as instructed above