This file contains 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 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 |
This file contains 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
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 |
This file contains 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 uuid | |
import json | |
import random | |
import keras | |
import numpy as np | |
import tensorflow as tf | |
import click | |
This file contains 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
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: |
This file contains 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 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]) |
This file contains 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 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 |
This file contains 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 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 |
This file contains 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
from flask import Flask | |
app = Flask(__name__) | |
@app.route("/") | |
def hello(): | |
return "Hello World!" | |
if __name__ == "__main__": | |
app.run() |
This file contains 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
\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*} |
This file contains 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 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) |