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
| #!/usr/bin/env python | |
| import math | |
| from math import sin, cos, pi | |
| import rospy | |
| import tf | |
| from nav_msgs.msg import Odometry | |
| from geometry_msgs.msg import Point, Pose, Quaternion, Twist, Vector3 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| """ 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 |
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 keras.models import Sequential | |
| from keras.layers import Dense | |
| from keras.utils.io_utils import HDF5Matrix | |
| import numpy as np | |
| def create_dataset(): | |
| import h5py | |
| X = np.random.randn(200,10).astype('float32') | |
| y = np.random.randint(0, 2, size=(200,1)) | |
| f = h5py.File('test.h5', 'w') |
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
| # Note – this is not a bash script (some of the steps require reboot) | |
| # I named it .sh just so Github does correct syntax highlighting. | |
| # | |
| # This is also available as an AMI in us-east-1 (virginia): ami-cf5028a5 | |
| # | |
| # The CUDA part is mostly based on this excellent blog post: | |
| # http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/ | |
| # Install various packages | |
| sudo apt-get update |
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
| #!/usr/bin/python3 | |
| import datetime | |
| import sys | |
| import math | |
| import numpy as np | |
| from argparse import ArgumentParser | |
| from collections import defaultdict | |
| from chainer import FunctionSet, Variable, functions, optimizers |
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
| #!/usr/bin/python3 | |
| # RNNLM trainer | |
| # date: 2015-8-25 | |
| # author: @odashi_t | |
| import datetime | |
| import sys | |
| 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
| # these code on this page are based on the following chainer's example. Thanks! | |
| # https://github.com/pfnet/chainer/tree/master/examples/mnist/train_mnist.py | |
| %matplotlib inline | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| from sklearn.datasets import fetch_mldata | |
| from chainer import cuda, Variable, FunctionSet, optimizers | |
| import chainer.functions as F | |
| import sys, time, math |
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 pandas as pd | |
| import numpy as np | |
| from sklearn.feature_extraction import DictVectorizer | |
| def encode_onehot(df, cols): | |
| """ | |
| One-hot encoding is applied to columns specified in a pandas DataFrame. | |
| Modified from: https://gist.github.com/kljensen/5452382 | |
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
| #!/usr/bin/python | |
| ''' Python command line argument example using argparse module | |
| Example output: | |
| ./parser.py --server=pyserver --port=8080,443,25,22,21 --keyword=pyisgood | |
| Server name: [ pyserver ] |
NewerOlder