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 Kaster | |
# License: BSD 3-clause | |
import numpy as np | |
def online_stats(X): | |
""" | |
Converted from John D. Cook | |
http://www.johndcook.com/blog/standard_deviation/ | |
""" |
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 | |
import numpy as np | |
from scipy.signal import lfilter | |
import matplotlib.pyplot as plt | |
sine = np.sin(np.linspace(-4 * np.pi, 4 * np.pi, 10000)) | |
noise = 0.2 * np.random.randn(len(sine)) | |
s = sine + noise |
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
# Original code from tinrtgu on Kaggle under WTFPL license | |
# Relicensed to BSD 3-clause (it does say do what you want...) | |
# Authors: Kyle Kastner | |
# License: BSD 3-clause | |
# Reference links: | |
# Adaptive learning: http://static.googleusercontent.com/media/research.google.com/en//pubs/archive/41159.pdf | |
# Criteo scalable response prediction: http://people.csail.mit.edu/romer/papers/TISTRespPredAds.pdf | |
# Vowpal Wabbit (hashing trick): https://github.com/JohnLangford/vowpal_wabbit/ | |
# Hashing Trick: http://arxiv.org/pdf/0902.2206.pdf |
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 | |
# License: BSD 3-clause | |
import theano.tensor as T | |
import numpy as np | |
import theano | |
class rmsprop(object): | |
""" | |
RMSProp with nesterov momentum and gradient rescaling |
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
# -*- coding: utf 8 -*- | |
# Author: Kyle Kastner | |
# License: BSD 3-clause | |
from __future__ import division | |
import os | |
import numpy as np | |
import tables | |
import numbers | |
import fnmatch |
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
ffmpeg -i 111.mp3 -acodec pcm_s16le -ac 1 -ar 16000 out.wav | |
find ../mp3_symlinks/ -name *.mp3 -exec sh -c 'echo $(basename {} .mp3)' \; | |
find ../mp3_symlinks/ -name *.mp3 -exec sh -c 'ffmpeg -i {} -acodec pcm_s16le -ac 1 -ar 16000 $(basename {} .mp3).wav' \; |
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
for f in *.ipynb ; do echo $f; aspell list < "$f" | sort | uniq -c ; done | less | |
2to3 -f imports folder/path | patch -p0 |
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 | |
# Clone or update all a user's gists | |
# curl -ks https://raw.github.com/gist/5466075/gist-backup.py | USER=fedir python | |
# USER=fedir python gist-backup.py | |
import json | |
import urllib.request, urllib.parse, urllib.error | |
from subprocess import call | |
from urllib.request import urlopen | |
import os |
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 | |
import theano | |
import theano.tensor as T | |
import pickle | |
class sgd_nesterov(object): | |
def __init__(self, params): | |
self.memory_ = [theano.shared(np.zeros_like(p.get_value())) | |
for p in params] |
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 | |
import theano | |
import theano.tensor as T | |
import pickle | |
d = pickle.load(open("info.pkl", mode="rb")) | |
X = d["X"] | |
y = d["y"] | |
fit_function2 = d["fit_function"] |