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
| 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 |
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
| 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() |
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
| """ | |
| 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 |
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
| SONNETS | |
| TO THE ONLY BEGETTER OF | |
| THESE INSUING SONNETS | |
| MR. W. H. ALL HAPPINESS | |
| AND THAT ETERNITY | |
| PROMISED BY | |
| OUR EVER-LIVING POET WISHETH |
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
| 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 |
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
| """ | |
| 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 |
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
| Using the rllab TRPO algorithm |
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
| Using TRPO from https://github.com/rllab/rllab |
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
| Following https://github.com/rllab/rllab |
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
| import gym | |
| env = gym.make('Reacher-v1') | |
| env.reset() | |
| env.render() | |
| env.monitor.start('/tmp/reacher-1', force=True) | |
| for i_episode in xrange(101): | |
| observation = env.reset() | |
| for t in xrange(100): | |
| env.render() |