Add overall setting and ddpg baseline (#1)

* Add overall CI settings

* Add specific build dir to travis

* Add before install/script condition to travis

* Add ddpg baseline

* Add wandb, remove algorithms except ddpg

* Remove init file in script

* Separate config file for ddpg

* Remove unnecessary examples

* Remove unnecessary args opt

* Add pre-commit setting

* Change pre-commit settings

* Change travis-ci setting

* Fix travis-ci issue

* Modify argparse arguments, fix requirements

* Change arguments order
This commit is contained in:
Whi Kwon
2019-02-05 20:07:46 +09:00
committed by GitHub
parent c7362ee828
commit 7f4756a1d4
17 changed files with 931 additions and 578 deletions
+39
View File
@@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
"""Noise classes for baselines."""
import copy
import random
import numpy as np
class OUNoise:
"""Ornstein-Uhlenbeck process.
Taken from Udacity deep-reinforcement-learning github repository:
https://github.com/udacity/deep-reinforcement-learning/blob/master/
ddpg-pendulum/ddpg_agent.py
"""
def __init__(self, size, seed, 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)
self.theta = theta
self.sigma = sigma
self.reset()
random.seed(seed)
def reset(self):
"""Reset the internal state (= noise) to mean (mu)."""
self.state = copy.copy(self.mu)
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(
[random.random() for _ in range(len(x))]
)
self.state = x + dx
return self.state