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
| # Author: Kyle Kastner | |
| # License: BSD 3-Clause | |
| # For a reference on parallel processing in Python see tutorial by David Beazley | |
| # http://www.slideshare.net/dabeaz/an-introduction-to-python-concurrency | |
| # Loosely based on IBM example | |
| # http://www.ibm.com/developerworks/aix/library/au-threadingpython/ | |
| try: | |
| import Queue | |
| except ImportError: | |
| import queue as Queue |
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
| # Authors: Kyle Kastner, Francesco Visin | |
| # License: BSD 3-Clause | |
| try: | |
| import Queue | |
| except ImportError: | |
| import queue as Queue | |
| import threading | |
| import time | |
| from matplotlib.path import Path | |
| from PIL import Image |
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
| import lasagne | |
| from lasagne.nonlinearities import rectify, softmax | |
| from lasagne.layers import InputLayer, DenseLayer, DropoutLayer, batch_norm, BatchNormLayer | |
| from lasagne.layers import ElemwiseSumLayer, NonlinearityLayer, GlobalPoolLayer | |
| from lasagne.layers.dnn import Conv2DDNNLayer as ConvLayer | |
| from lasagne.init import HeNormal | |
| def ResNet_FullPre_Wide(input_var=None, n=3, k=2): | |
| ''' | |
| Adapted from https://github.com/Lasagne/Recipes/tree/master/papers/deep_residual_learning. |
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 |
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
| import numpy as np | |
| from keras.layers import GRU, initializations, K | |
| from collections import OrderedDict | |
| class GRULN(GRU): | |
| '''Gated Recurrent Unit with Layer Normalization | |
| Current impelemtation only works with consume_less = 'gpu' which is already | |
| set. | |
| # Arguments |
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
| import datetime | |
| import pytz | |
| from tensorflow.contrib.session_bundle import exporter | |
| from tensorflow.python.client import timeline | |
| import glob | |
| import json | |
| import time | |
| import math | |
| import numpy as np | |
| import os |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.