Code for Keras plays catch blog post
python qlearn.py
- Generate figures
Code for Keras plays catch blog post
python qlearn.py
import numpy as np | |
import matplotlib as mpl | |
mpl.use('Agg') | |
import matplotlib.pyplot as plt | |
from pyearth import Earth | |
import time | |
from itertools import product | |
np.random.seed(2) |
import numpy as np | |
import os | |
import matplotlib as mpl | |
mpl.use('Agg') | |
import matplotlib.pyplot as plt | |
from pyearth import Earth | |
import time | |
np.random.seed(2) |
import numpy | |
from scipy.ndimage.interpolation import map_coordinates | |
from scipy.ndimage.filters import gaussian_filter | |
def elastic_transform(image, alpha, sigma, random_state=None): | |
"""Elastic deformation of images as described in [Simard2003]_. | |
.. [Simard2003] Simard, Steinkraus and Platt, "Best Practices for | |
Convolutional Neural Networks applied to Visual Document Analysis", in |
import numpy as np | |
import time | |
from joblib import Memory | |
import pandas as pd | |
from bokeh.charts import show, Bar | |
from bokeh.io import output_file, vplot |
""" | |
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) |
from sklearn.ensemble import RandomForestRegressor | |
from sklearn.base import clone | |
import numpy as np | |
class GAM(object): | |
""" | |
Simple generalized additive model which fits each feature w.r.t | |
the output independently using a model specified by | |
base_estimator. the final predictions can be done by regressing linearly | |
the predictions of the model of each features by using a pipeline. |
from tempfile import mkdtemp | |
import shutil | |
import os | |
import sys | |
import subprocess | |
from skimage.io import imsave | |
cmd_tpl = 'ffmpeg -y -framerate {framerate} -i {pattern} -c:v libx264 -r {rate} -pix_fmt yuv420p {out}' |
# Code adapted from https://github.com/kylemcdonald/Parametric-t-SNE | |
import numpy as np | |
import theano.tensor as T | |
def Hbeta(D, beta): | |
P = np.exp(-D * beta) | |
sumP = np.sum(P) | |
H = np.log(sumP) + beta * np.sum(np.multiply(D, P)) / sumP | |
P = P / sumP | |
return H, P |
""" | |
Implementation of pairwise ranking using scikit-learn LinearSVC | |
Reference: "Large Margin Rank Boundaries for Ordinal Regression", R. Herbrich, | |
T. Graepel, K. Obermayer. | |
Authors: Fabian Pedregosa <fabian@fseoane.net> | |
Alexandre Gramfort <alexandre.gramfort@inria.fr> | |
""" |