Last active
August 6, 2016 20:02
-
-
Save evancasey/5315a8d51f3b09dffe8a7045e508a842 to your computer and use it in GitHub Desktop.
CEM main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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