From 42f432c79c286901064739a1bff32555e757071a Mon Sep 17 00:00:00 2001 From: mloo3 Date: Mon, 1 Jun 2020 04:37:42 -0400 Subject: [PATCH] Fix TD3 Example Code Documentation (#38) Fix TD3's example code --- docs/misc/changelog.rst | 3 ++- docs/modules/td3.rst | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/misc/changelog.rst b/docs/misc/changelog.rst index 174efde..5bceb63 100644 --- a/docs/misc/changelog.rst +++ b/docs/misc/changelog.rst @@ -45,6 +45,7 @@ Documentation: - Added most documentation (adapted from Stable-Baselines) - Added link to CONTRIBUTING.md in the README (@kinalmehta) - Added gSDE project and update docstrings accordingly +- Fix ``TD3`` example code block Pre-Release 0.5.0 (2020-05-05) @@ -230,4 +231,4 @@ And all the contributors: @XMaster96 @kantneel @Pastafarianist @GerardMaggiolino @PatrickWalter214 @yutingsz @sc420 @Aaahh @billtubbs @Miffyli @dwiel @miguelrass @qxcv @jaberkow @eavelardev @ruifeng96150 @pedrohbtp @srivatsankrishnan @evilsocket @MarvineGothic @jdossgollin @SyllogismRXS @rusu24edward @jbulow @Antymon @seheevic @justinkterry @edbeeching -@flodorner @KuKuXia @NeoExtended @PartiallyTyped @mmcenta @richardwu @kinalmehta @rolandgvc @tkelestemur +@flodorner @KuKuXia @NeoExtended @PartiallyTyped @mmcenta @richardwu @kinalmehta @rolandgvc @tkelestemur @mloo3 diff --git a/docs/modules/td3.rst b/docs/modules/td3.rst index 86a939d..cb2a4e1 100644 --- a/docs/modules/td3.rst +++ b/docs/modules/td3.rst @@ -62,17 +62,20 @@ Example .. code-block:: python + import gym import numpy as np from stable_baselines3 import TD3 from stable_baselines3.td3.policies import MlpPolicy from stable_baselines3.common.noise import NormalActionNoise, OrnsteinUhlenbeckActionNoise + env = gym.make('Pendulum-v0') + # The noise objects for TD3 n_actions = env.action_space.shape[-1] action_noise = NormalActionNoise(mean=np.zeros(n_actions), sigma=0.1 * np.ones(n_actions)) - model = TD3(MlpPolicy, 'Pendulum-v0', action_noise=action_noise, verbose=1) + model = TD3(MlpPolicy, env, action_noise=action_noise, verbose=1) model.learn(total_timesteps=10000, log_interval=10) model.save("td3_pendulum") env = model.get_env()