Skip to content

Instantly share code, notes, and snippets.

Avatar

vincent d warmerdam koaning

View GitHub Profile
@koaning
koaning / experiment.py
Created Jan 16, 2020
demonstrates the diminishing dependence as features increase
View experiment.py
import numpy as np
import matplotlib.pylab as plt
def run_with_samples(feats=1):
n = 1000
xs = np.random.uniform(0, 2, (n, feats))
ys = 1.5 + xs.sum(axis=1) + np.random.normal(0, 1, (n,))
size_subset = 500
n_samples = 2000
@koaning
koaning / biased-hard.csv
Last active Nov 29, 2019
feedback experiment
View biased-hard.csv
x y z
575.9169941454602 456.4364641163653 b
524.7679233463399 454.659622813655 b
536.1853203147283 414.6387874887763 b
554.7345847720682 392.6003138461853 b
558.7216445350003 455.7009797890023 b
512.1738453368777 407.6844578991705 b
494.68119055863497 379.00447835274645 b
521.4275424582694 409.29480593833387 b
504.69631038511756 417.3711528143935 b
@koaning
koaning / main.py
Created Nov 16, 2019
keras grid job
View main.py
import uuid
import json
import random
import keras
import numpy as np
import tensorflow as tf
import click
View lamarl.py
async def fetch(url, json_body, session):
async with session.post(url, json=json_body) as response:
return await response.read()
async def run(json_bodies, n_sim=1000):
tasks = []
url = make_url(n_sim=n_sim)
# Fetch all responses within one Client session,
# keep connection alive for all requests.
async with ClientSession(connector=TCPConnector(limit=None), read_timeout=60000, conn_timeout=60000) as session:
@koaning
koaning / app.py
Created Jan 14, 2018
sushigo-chalice
View app.py
import random
import math
from chalice import Chalice
app = Chalice(app_name='sushigo-algorithm')
app.debug = False
def sort_hand(hand, order):
card_dict = {card: i for i, card in enumerate(order)}
return sorted(hand, key=lambda x: card_dict[x])
@koaning
koaning / gpu-gradient.py
Last active Apr 26, 2017
same board but with gpu
View gpu-gradient.py
import tensorflow as tf
import numpy as np
import os
import uuid
TENSORBOARD_PATH = "/tmp/tensorboard-switchpoint"
# tensorboard --logdir=/tmp/tensorboard-switchpoint
x1 = np.random.randn(35) - 1
x2 = np.random.randn(35) * 2 + 5
@koaning
koaning / gradient-board.py
Created Apr 22, 2017
tensorflow and tensorboard gradient search
View gradient-board.py
import tensorflow as tf
import numpy as np
import os
import uuid
TENSORBOARD_PATH = "/tmp/tensorboard-switchpoint"
# tensorboard --logdir=/tmp/tensorboard-switchpoint
x1 = np.random.randn(35)-1
x2 = np.random.randn(35)*2 + 5
@koaning
koaning / app.py
Created Mar 24, 2017
flask super basic start
View app.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
@koaning
koaning / latex
Created Mar 14, 2017
latex align
View latex
\begin{align*}
E[\pmb{Ax + y}] &= \pmb{A}(E[\pmb{x}]) + \pmb{y} \\
Cov[\pmb{Ax + y}] &= \pmb{A}(Cov[\pmb{x}])\pmb{A}^T
\end{align*}
@koaning
koaning / tf.py
Created Mar 9, 2017
tensorflow layer example
View tf.py
import tensorflow as tf
import numpy as np
import uuid
x = tf.placeholder(shape=[None, 3], dtype=tf.float32)
nn = tf.layers.dense(x, 3, activation=tf.nn.sigmoid)
nn = tf.layers.dense(nn, 5, activation=tf.nn.sigmoid)
encoded = tf.layers.dense(nn, 2, activation=tf.nn.sigmoid)
nn = tf.layers.dense(encoded, 5, activation=tf.nn.sigmoid)
nn = tf.layers.dense(nn, 3, activation=tf.nn.sigmoid)