start new:
tmux
start new with session name:
tmux new -s myname
| # coding=utf-8 | |
| # Copyright 2017 The Tensor2Tensor Authors. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software |
| import logging | |
| import numpy as np | |
| import tensorflow as tf | |
| from tensorflow.contrib import layers | |
| GO_TOKEN = 0 | |
| END_TOKEN = 1 | |
| UNK_TOKEN = 2 |
| """ 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 |
| import theano | |
| import theano.tensor as T | |
| from theano.tensor.shared_randomstreams import RandomStreams | |
| from theano.sandbox.rng_mrg import MRG_RandomStreams | |
| from lasagne.updates import adam | |
| from lasagne.utils import collect_shared_vars | |
| from sklearn.datasets import fetch_mldata | |
| from sklearn.cross_validation import train_test_split | |
| from sklearn import preprocessing |
| """ | |
| Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
| BSD License | |
| """ | |
| import numpy as np | |
| # data I/O | |
| data = open('input.txt', 'r').read() # should be simple plain text file | |
| chars = list(set(data)) | |
| data_size, vocab_size = len(data), len(chars) |
| Lisp interpreter in 90 lines of C++ | |
| I've enjoyed reading Peter Norvig's recent articles on Lisp. He implements a Scheme interpreter in 90 lines of Python in the first, and develops it further in the second. | |
| Just for fun I wondered if I could write one in C++. My goals would be | |
| 1. A Lisp interpreter that would complete Peter's Lis.py test cases correctly... | |
| 2. ...in no more than 90 lines of C++. | |
| Although I've been thinking about this for a few weeks, as I write this I have not written a line of the code. I'm pretty sure I will achieve 1, and 2 will be... a piece of cake! |