Skip to content

Instantly share code, notes, and snippets.

View keithmgould's full-sized avatar

Keith Gould keithmgould

  • New York
View GitHub Profile
@keithmgould
keithmgould / cartpole_pg.py
Last active December 22, 2017 22:49 — forked from shanest/cartpole_pg.py
Policy gradients for reinforcement learning in TensorFlow (OpenAI gym CartPole environment)
#!/usr/bin/env python
import gym
import numpy as np
import tensorflow as tf
from tensorflow.python.ops import random_ops
def _initializer(shape, dtype=tf.float32, partition_info=None):
return random_ops.random_normal(shape)
@keithmgould
keithmgould / pg-pong.py
Created October 26, 2017 20:58 — forked from karpathy/pg-pong.py
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
alias undeployed="heroku releases -a APP_NAME | sed -n 2p | cut -d' ' -f4 | xargs -J % git log --oneline --decorate --color --graph master --not %"