Git Product home page Git Product logo

navigation-rl's Introduction

Navigation-RL

This is implementation of a RL agent that learns to play the Banana Collector game.

Environment

The environment is a plane with yellow and blue bananas in the plane. The bananas are kept randomly in the plane.

alt text

Goal

The goal is to collect as many yellow bananas as possible while avoiding blue bananas.

State Space

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.

Action space

There are 4 possible actions:

  • 0: Forward
  • 1: Backward
  • 2: Left
  • 3: Right

Rewards

The reward function looks something like below -

  1. +1 for interaction with yellow banana
  2. -1 for interaction with blue banana

Getting Started

Creating an environment(conda) that fulfills the requirements

After creating the conda environment using the commands mentioned below and activating it, you will be able to run the code in this repository.

Creating the conda environment

conda create --name bananas python=3.6

conda activate bananas

Installing the requirements

Note - If you are having a problem with loading unityagents library in python or problem with loading the Banana environment, the following these steps of creating the environment, activating the created environment and installing the requirements mentioned in requirements.txt may help. Sometimes, the environment may not load from jupyter notebook, so run it from python script instead.

pip install -r requirements.txt

Downloading the environment(task)

Download the environment from one of the links below. You need only select the environment that matches your operating system:

Instructions

Training the agent

Simply run the train.py script using the following command

python train.py

The above script runs the training for 1800 episodes and saves the data in the form of a dictionary as a file named as "checkpoint.pth"

Testing the agent

Running the test.py runs loads the model saved by the train.py script and runs 10 episodes with the trained Q Network which takes a state and returns best action that maximises the action value function.

python test.py

navigation-rl's People

Contributors

mijo2 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.