Giter Club home page Giter Club logo

abenicoccolimsaadtisi-lfhf's Introduction

Initialization

Create a conda enviroment with python 3.7 in order to do not create conflicts between different libraries:

conda create -n "name_of_virtenv" python=3.7

Activate the environment:

conda activate "name_of_virtenv"

Clone the repository:

git clone https://github.com/nico-abe6/AbeniCoccoliMsaadTisi-LfHF.git

Then install all the necessary libraries in the requirement file through the command:

pip install -r requirements.txt

After having installed the requirements is necessary to upgrade the library pyglet even if is not supported by gym=0.15.4, after the installation you'll see a conflict but everything will work fine.

pip install pyglet==1.5.11

Learning from Human Preferences

Inside the folder RL_HumanPreferences launch the file main.py

python main.py

When the program asks for preferences click 1, 2 or 3 in order to do selection, and then the data will be stored in the folder and the plot in the folder plots/dqn.

Learning From Demonstration

Play the game and registration of data

In the OpenAI gym folder launch the play.py file with the following command

python3 play.py CartPole-v1 --delay=50`-o data

where CartPole is the enviroment to play in, delay is to slow down the frames in order to make it more easier for a human to play, data is the destination folder where the vectors with states,actions... are going to be stored.

Train the agent with DQN

Now make a copy of the CartPoleDemo.txt from data folder to the /AbeniCoccoliMsaadTisi-LfHF/DRL-using-PyTorch/DQNfromDemo/Test rename it differently but in this case you have to open manually the CartPole.py and insert the name of the file in the line of code 24 where the TEST list is.

run CartPole.py

python CartPole.py

then it is going to save the reward learning list and plot the results, the learning curve and the test results.

Plot the 3 different approaches

Copy the .npy array with the rewards from HumanPreference to the /AbeniCoccoliMsaadTisi-LfHF/DRL-using-PyTorch/DQNfromDemo/Test folder open the plot_learning_curves.py script, insert the names of the files correctly, rewards from HP and from LfD and DQN run the plot_learning_curves.py to see the 3 methods learning curves compared.

abenicoccolimsaadtisi-lfhf's People

Contributors

nico-abe6 avatar 99abdel avatar federtisi 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.