From 0b71d4c6c44d720b760d117dd9b9e9c3230d5804 Mon Sep 17 00:00:00 2001 From: pzhokhov Date: Wed, 7 Nov 2018 17:19:25 -0800 Subject: [PATCH 1/5] remove unused args of DDPG class (#702) --- baselines/ddpg/ddpg_learner.py | 1 - 1 file changed, 1 deletion(-) diff --git a/baselines/ddpg/ddpg_learner.py b/baselines/ddpg/ddpg_learner.py index b8a5d60..a065c98 100755 --- a/baselines/ddpg/ddpg_learner.py +++ b/baselines/ddpg/ddpg_learner.py @@ -67,7 +67,6 @@ class DDPG(object): def __init__(self, actor, critic, memory, observation_shape, action_shape, param_noise=None, action_noise=None, gamma=0.99, tau=0.001, normalize_returns=False, enable_popart=False, normalize_observations=True, batch_size=128, observation_range=(-5., 5.), action_range=(-1., 1.), return_range=(-np.inf, np.inf), - adaptive_param_noise=True, adaptive_param_noise_policy_threshold=.1, critic_l2_reg=0., actor_lr=1e-4, critic_lr=1e-3, clip_norm=None, reward_scale=1.): # Inputs. self.obs0 = tf.placeholder(tf.float32, shape=(None,) + observation_shape, name='obs0') From c14d30783405292ba27b11208d583b27ffd55ff0 Mon Sep 17 00:00:00 2001 From: pzhokhov Date: Wed, 7 Nov 2018 17:19:42 -0800 Subject: [PATCH 2/5] move viz docs to a notebook entirely (#704) * viz docs * writing vizualization docs * documenting plot_util * docstrings in plot_util * autopep8 and flake8 * spelling (using default vim spellchecker and ingoring things like dataframe, docstring and etc) * rephrased viz.md a little bit * more examples of viz code usage in the docs * replaced vizualization doc with notebook --- README.md | 2 +- baselines/common/plot_util.py | 2 +- docs/viz/viz.ipynb | 808 ++++++++++++++++++++++++++++++++++ docs/viz/viz.md | 136 ------ 4 files changed, 810 insertions(+), 138 deletions(-) create mode 100644 docs/viz/viz.ipynb delete mode 100644 docs/viz/viz.md diff --git a/README.md b/README.md index e382a8b..e4f8697 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ python -m baselines.run --alg=ppo2 --env=PongNoFrameskip-v4 --num_timesteps=0 -- *NOTE:* At the moment Mujoco training uses VecNormalize wrapper for the environment which is not being saved correctly; so loading the models trained on Mujoco will not work well if the environment is recreated. If necessary, you can work around that by replacing RunningMeanStd by TfRunningMeanStd in [baselines/common/vec_env/vec_normalize.py](baselines/common/vec_env/vec_normalize.py#L12). This way, mean and std of environment normalizing wrapper will be saved in tensorflow variables and included in the model file; however, training is slower that way - hence not including it by default ## Loading and vizualizing learning curves and other training metrics -See [here](docs/viz/viz.md) for instructions on how to load and display the training data. +See [here](docs/viz/viz.ipynb) for instructions on how to load and display the training data. ## Subpackages diff --git a/baselines/common/plot_util.py b/baselines/common/plot_util.py index 1d105c8..8009295 100644 --- a/baselines/common/plot_util.py +++ b/baselines/common/plot_util.py @@ -332,7 +332,7 @@ def plot_results( xys = gresults[group] if not any(xys): continue - color = COLORS[groups.index(group)] + color = COLORS[groups.index(group) % len(COLORS)] origxs = [xy[0] for xy in xys] minxlen = min(map(len, origxs)) def allequal(qs): diff --git a/docs/viz/viz.ipynb b/docs/viz/viz.ipynb new file mode 100644 index 0000000..6eb0cf0 --- /dev/null +++ b/docs/viz/viz.ipynb @@ -0,0 +1,808 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "Ynb-laSwmpac" + }, + "source": [ + "# Loading and visualizing results ([open in colab](https://colab.research.google.com/github/openai/baselines/blob/master/docs/viz.ipynb))\n", + "In order to compare performance of algorithms, we often would like to visualize learning curves (reward as a function of time steps), or some other auxiliary information about learning aggregated into a plot. Baselines repo provides tools for doing so in several different ways, depending on the goal." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "yreoV7OClzYG" + }, + "source": [ + "## Preliminaries / TensorBoard\n", + "First, let us install baselines repo from github" + ] + }, + { + "cell_type": "code", + "execution_count": 0, + "metadata": { + "colab": {}, + "colab_type": "code", + "id": "r4Aul2Qujlg9" + }, + "outputs": [], + "source": [ + "!pip install git+https://github.com/openai/baselines > ~/pip_install_baselines.log" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "1n7XAyVWniRp" + }, + "source": [ + "For all algorithms in baselines summary data is saved into a folder defined by logger. By default, a folder $TMPDIR/openai--