Skip to content

Instantly share code, notes, and snippets.

View korymath's full-sized avatar

Kory korymath

View GitHub Profile
Following https://github.com/rllab/rllab
Using TRPO from https://github.com/rllab/rllab
Using the rllab TRPO algorithm
"""
Policy Gradients
1. Sample paths.
2. Process paths (compute advantage, baseline, rewards, etc)
3. Run the paths through the policy (function approximator)
4. Compute gradients/update policy model weights
5. Profit?!?!
How we optimize the policy
--------------------------
L(theta) = sum t=0 to T-1 log policy(action_t | state_t, theta) * A_t
@korymath
korymath / init.lua
Created June 28, 2016 13:39
Hammerspoon configuration for window management
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Left", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = max.x
f.y = max.y
f.w = max.w / 2
f.h = max.h
SONNETS
TO THE ONLY BEGETTER OF
THESE INSUING SONNETS
MR. W. H. ALL HAPPINESS
AND THAT ETERNITY
PROMISED BY
OUR EVER-LIVING POET WISHETH
"""
Translated from https://webdocs.cs.ualberta.ca/~sutton/MountainCar/MountainCar1.cp
Algorithm described at https://webdocs.cs.ualberta.ca/~sutton/book/ebook/node89.html
Some minor adjustments to constants were made to make the program work on environments
besides Mountain Car.
"""
import random
import math
import numpy as np
@korymath
korymath / nips-accepted-papers.py
Last active August 23, 2016 01:09
Quick n-gram discovery on the NIPS 2016 accepted papers, from https://nips.cc/Conferences/2016/AcceptedPapers.
from sklearn.feature_extraction.text import CountVectorizer
from collections import Counter
import numpy as np
with open('accepted-papers.txt', 'r') as myfile:
data=myfile.read().replace('\n', '')
lectures = data
bigram_vectorizer = CountVectorizer(ngram_range=(2, 10), stop_words='english')
analyze = bigram_vectorizer.build_analyzer()
Following the installation and first test for torch-twrl
https://github.com/twitter/torch-twrl
Run code:
cd examples
chmod u+x cartpole-pg.sh
./cartpole-pg.sh
https://krb-sjobs.brassring.com/TGnewUI/Search/home/HomeWithPreLoad?PageType=JobDetails&jobid=74414&partnerid=26059&siteid=5016&type=mail