Skip to content

Navigation project of Udacity Deep Reinforcement Learning

License

Notifications You must be signed in to change notification settings

frgfm/drlnd-p1-navigation

Repository files navigation

Banana craving monkey

License Codacy Badge CircleCI

This repository is an implementation of DQN agent for the navigation project of Udacity Deep Reinforcement Learning nanodegree, in the banana collection game provided by unity.

banana-gif

Table of Contents

Environment

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 the 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.

Getting started

Prerequisites

Installation

You can install the project requirements as follows:

git clone https://github.com/frgfm/banana-craving-monkey.git
cd banana-craving-monkey
pip install -r requirements.txt

Download the environment build corresponding to your OS

Then extract the archive in the project folder.

If you wish to use the agent trained by repo owner, you can download the model parameters as follows:

wget https://github.com/frgfm/banana-craving-monkey/releases/download/v0.1.0/dqn_fixed_target.pt

Usage

Training

All training arguments can be found using the --help flag:

python train.py --help

Below you can find an example to train your agent:

python train.py --deterministic --lr 5e-4 --no-graphics --eps-decay 0.98 --eps-end 0.02

Evaluation

You can use an existing model's checkpoint to evaluate your agent as follows:

python evaluate.py --checkpoint ./dqn_fixed_target.pt

Credits

This implementation is vastly based on the following papers:

License

Distributed under the MIT License. See LICENSE for more information.