March 2019
Intermediate to advanced
184 pages
4h 57m
English
We will now code the train_test.py file.
import tensorflow as tfimport numpy as npimport matplotlib.pyplot as pltimport gymimport sysimport timefrom class_ppo import *
def reward_shaping(s_): r = 0.0 if s_[0] > -0.4: r += 5.0*(s_[0] + 0.4) if s_[0] > 0.1: r += 100.0*s_[0] if s_[0] < -0.7: r += 5.0*(-0.7 - s_[0]) if s_[0] < 0.3 and np.abs(s_[1]) ...
Read now
Unlock full access