Convert code to python 2.7 (#35)

* Convert code format to python2.7 (SAC)

* Convert code format python2.7 (TD3, all fD)

* Remove no use import and black setting

* Change SAC param

* Change env name Reacher-v2 to v1

* Remove old version reacher training script

* Convert code format python2.7

* Modify .travis.yml

* Add install command python3.6 & black on Makefile

* Fix seperator to tab on Makefile

* Modify Makefile

* Fix little error

* Change td3 gamma parameter
This commit is contained in:
Kyunghwan Kim
2019-03-25 19:07:19 +09:00
committed by Whi Kwon
parent 81a9d861b6
commit d2769dfa9d
39 changed files with 154 additions and 286 deletions
+4 -12
View File
@@ -13,20 +13,14 @@ class GaussianNoise:
Taken from https://github.com/vitchyr/rlkit
"""
def __init__(
self,
action_dim: int,
min_sigma: float = 1.0,
max_sigma: float = 1.0,
decay_period: int = 1000000,
):
def __init__(self, action_dim, min_sigma=1.0, max_sigma=1.0, decay_period=1000000):
"""Initialization."""
self.action_dim = action_dim
self.min_sigma = min_sigma
self.max_sigma = max_sigma
self.decay_period = decay_period
def sample(self, t: int = 0) -> float:
def sample(self, t=0):
"""Get an action with gaussian noise."""
sigma = self.max_sigma - (self.max_sigma - self.min_sigma) * min(
1.0, t / self.decay_period
@@ -42,9 +36,7 @@ class OUNoise:
ddpg-pendulum/ddpg_agent.py
"""
def __init__(
self, size: int, mu: float = 0.0, theta: float = 0.15, sigma: float = 0.2
):
def __init__(self, size, mu=0.0, theta=0.15, sigma=0.2):
"""Initialize parameters and noise process."""
self.state = np.float64(0.0)
self.mu = mu * np.ones(size)
@@ -56,7 +48,7 @@ class OUNoise:
"""Reset the internal state (= noise) to mean (mu)."""
self.state = copy.copy(self.mu)
def sample(self) -> float:
def sample(self):
"""Update internal state and return it as a noise sample."""
x = self.state
dx = self.theta * (self.mu - x) + self.sigma * np.array(