Skip to content

Instantly share code, notes, and snippets.

@steleu
steleu / pg-mountaincar.py
Last active August 5, 2016 13:48 — forked from karpathy/pg-pong.py
Training a Neural Network MountainCar-v0 agent with Policy Gradients from raw pixels
# -*- coding: utf-8 -*-
""" Trains an agent with (stochastic) Policy Gradients on MountainCar-v0. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 5 # every how many episodes to do a param update?