Experimental part of master thesis at the university of Duisburg-Essen at the department of "Modellierung Adaptiver Systeme". Read the thesis for further understanding of the experiments.
Be aware about the fact that these experiments were only tested on Linux (using Ubuntu 16.04 LTS). Experiment 1 can probably run on MS Windows 10, but experiment 2 depends on atari_py using ALE which was in context of OpenAI's gym not runnable on Windows 10.
A GPU is needed to run them effectively. We tested this experiments on a Nvidia Geforce 1070 Ti with 8 GB of VRAM.
Both experiments depend on Rscript, python 3.6 and needed following R libraries.
Do this in your user/global R environment:
install.packages("tidyverse")
install.packages("scales")
install.packages("Hmisc")
- Copy code on a read-write medium (skip if you git clone)
- Install dependencies
- Create a virtual python environment and active it.
virtualenv -p python3 ./src.experiment1/ source src.experiment1/bin/activate
- Install numpy.
pip3 install -U numpy==1.14.5
- Install tensorflow in GPU mode and check if it runs correctly. (Beware of addition steps need in GPU mode. You need proprietary libraries from e.g. Nvidia )
pip3 install -U tensorflow-gpu==1.8 python -c "import tensorflow as tf; print(tf.__version__)"
- Install pandas.
pip3 install -U pandas
- Install scikit-learn.
pip3 install -U sklearn
- Install imbalanced-learn.
pip3 install -U imblearn
- Create a new directory which will contain the results.
mkdir ./src.experiment1/<timestamp>.data
- Change directory to the data folder.
cd ./src.experiment1/<timestamp>.data
- Run the core experiment (will take approximately more than 48h).
bash ../run_experiment1.sh
- Yield results.
- Copy code on a read-write medium (skip if you git clone)
- Install dependencies
- Create a virtual python environment and activate it.
virtualenv -p python3 ./src.experiment1/ source src.experiment1/bin/activate
- Install numpy.
pip3 install -U numpy==1.14.5
- Install tensorflow in GPU mode and check if it runs correctly. (Beware of addition steps need in GPU mode. You need proprietary libraries from e.g. Nvidia )
pip3 install -U tensorflow-gpu==1.8 python -c "import tensorflow as tf; print(tf.__version__)"
- Install opencv. It is needed by baselines.
pip3 install -U opencv-python
- Install atari_py. It is needed by gym.
pip3 install -U atari_py
- Install OpenAI gym.
pip3 install -U gym==0.10.5
- Install OpenAI baselines. Note that baselines is monkey punched and is already in the repository.
cd ./src.experiment2/baselines/ pip3 install -U -e .
- Create a new directory which will contain the results.
mkdir ./baselines/deepq/experiments/<timestamp>.data
- Change directory to the data folder.
cd ./baselines/deepq/experiments/<timestamp>.data
- Run the core experiment (will take approximately more than 48h).
bash ../run_pong_experiment.sh
- Yield results.
Option to run both experiments after each other (first experiment1, second experiment2):
- Do both step 1 and step 2 from instructions from each experiment.
- Run script (takes more than four days of computation)
bash run_all_experiment.sh
- enjoy the results in the folders mentioned in top part.
Be aware when some packages forcing numpy, tensorflow-gpu or gym to be on wrong version. Check on each step if any new versions of this packages were forced to be installed.
Check if no tensorflow duplicate packages are in environment.
pip3 list | grep tensorflow
Should return that only tensorflow-gpu is installed and no tensorflow (without gpu) is installed.
When no GPU is available you can install tensorflow in CPU mode Replace step 1.3 in the experiments by
pip3 install -U tensorflow==1.8
Be warned that running the experiment on CPU takes ages.
Check if you using GPU (on NVIDIA for example with)
nvidia-smi
Experiments will fail when they not fit in VRAM. We tested only with 8 GB of VRAM. When fewer VRAM is available the running scripts should be adjusted by hand to do smaller parallel runs of in each experiment. (just put some 'wait' between the calls)
You can check available VRAM for example on a nvidia GPU with:
nvidia-smi