Skip to content

Instantly share code, notes, and snippets.

@evancasey
Last active August 6, 2016 20:02
Show Gist options
  • Select an option

  • Save evancasey/5315a8d51f3b09dffe8a7045e508a842 to your computer and use it in GitHub Desktop.

Select an option

Save evancasey/5315a8d51f3b09dffe8a7045e508a842 to your computer and use it in GitHub Desktop.
CEM main
# Gym params
EXPERIMENT_DIR = './cartpole-experiment-1'
if __name__ == "__main__":
np.random.seed(0)
env = gym.make('CartPole-v0')
env.monitor.start(EXPERIMENT_DIR, force=True)
num_features = env.observation_space.shape[0]
with tf.Session() as sess:
linear_network = LinearModel(sess, num_features)
cem = CEM(num_features = num_features, \
sess = sess, \
pred_network = linear_network, \
env = env, \
batch_size = 30, \
max_num_steps = 200, \
elite_frac = .2, \
n_iter = 20)
cem.train()
print(cem.perf_hist)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment