start new:
tmux
start new with session name:
tmux new -s myname
| def minibatcher(fn, batchsize=1000): | |
| """ | |
| fn : a function that takes an input and returns an output | |
| batchsize : divide the total input into divisions of size batchsize at most | |
| iterate through all the divisions, call fn, get the results, | |
| then concatenate all the results. | |
| """ | |
| def f(X): | |
| results = [] |
| 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 |
| class EnsembleRegressor(object): | |
| def __init__(self, regs=None): | |
| self.regs = regs | |
| def fit(self, X, y): | |
| return self | |
| def predict(self, X, return_std=False): | |
| if return_std: | |
| means = [] |
| import collections | |
| def flatten_dict(l): | |
| d = {} | |
| for k, v in l.items(): | |
| if isinstance(v, collections.Mapping): | |
| d.update(flatten_dict(v)) | |
| elif isinstance(v, list) or isinstance(v, tuple): | |
| for i, l in enumerate(v): | |
| d[k+'_{}'.format(i)] = l |
| Latency Comparison Numbers | |
| -------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| # Implementation of a simple character RNN (using LSTM units), based on: | |
| # https://github.com/karpathy/char-rnn | |
| # Source : https://github.com/fchollet/keras/pull/2137 | |
| import numpy as np | |
| from keras.models import Sequential | |
| from keras.layers.core import Dense, Activation, Dropout, TimeDistributedDense | |
| from keras.layers.recurrent import LSTM | |
| text = open('input.txt', 'r').read() |
| Code Complete by Steve McConnell | |
| Jeff Atwood (Coding Horror) | |
| https://blog.codinghorror.com/code-reviews-just-do-it/ | |
| Measuring Defect Potentials and Defect Removal Efficiency | |
| http://rbcs-us.com/site/assets/files/1337/measuring-defect-potentials-and-defect-removal-efficiency.pdf | |
| Expectations, Outcomes, and Challenges Of Modern Code Review | |
| https://www.microsoft.com/en-us/research/publication/expectations-outcomes-and-challenges-of-modern-code-review/ |
| Code Complete by Steve McConnell | |
| Jeff Atwood (Coding Horror) | |
| https://blog.codinghorror.com/code-reviews-just-do-it/ | |
| Measuring Defect Potentials and Defect Removal Efficiency | |
| http://rbcs-us.com/site/assets/files/1337/measuring-defect-potentials-and-defect-removal-efficiency.pdf | |
| Expectations, Outcomes, and Challenges Of Modern Code Review | |
| https://www.microsoft.com/en-us/research/publication/expectations-outcomes-and-challenges-of-modern-code-review/ |
| import matplotlib as mpl | |
| mpl.use('Agg') | |
| import matplotlib.pyplot as plt | |
| import matplotlib.gridspec as gridspec | |
| from clize import run | |
| from subprocess import call | |
| import time | |
| import pandas as pd | |