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 collections | |
import dataclasses | |
import itertools | |
import typing as tp | |
from functools import partial | |
import numpy as np | |
from scipy.optimize import minimize | |
DEFAULT_CI_SIZE = 0.95 |
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 theano.tensor as T | |
import pymc3 as pm | |
from utils import add_params_property | |
import ranking | |
from ranking import tennis_data, MPTrueSkill1V1NoDrawRanker |
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
#!/usr/bin/env python3 | |
import subprocess | |
import shlex | |
import os | |
from pathlib import Path | |
def chdir_to_script_location(): | |
abspath = os.path.abspath(__file__) |
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
#!/usr/bin/env python3 | |
import subprocess | |
import shlex | |
import os | |
from pathlib import Path | |
def chdir_to_script_location(): | |
abspath = os.path.abspath(__file__) |
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
#!/usr/bin/env python3 | |
import subprocess | |
import shlex | |
import os | |
from pathlib import Path | |
def chdir_to_script_location(): | |
abspath = os.path.abspath(__file__) |
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
function isString(s) { | |
return (typeof s === 'string' || s instanceof String) | |
} | |
export function toBaseUnit(value, decimals, BN) { | |
if (!isString(value)) { | |
throw new Error('Pass strings to prevent floating point precision issues.') | |
} | |
const ten = new BN(10); | |
const base = ten.pow(new BN(decimals)); |
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 keras.backend as kb | |
from keras.layers import Layer | |
def _kb_linspace(num): | |
num = kb.cast(num, kb.floatx()) | |
return kb.arange(0, num, dtype=kb.floatx()) / (num - 1) | |
def _kb_grid_coords(width, height): | |
w, h = width, height | |
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
def tf_pca(x): | |
''' | |
Compute PCA on the bottom two dimensions of x, | |
eg assuming dims = [..., observations, features] | |
''' | |
# Center | |
x -= tf.reduce_mean(x, -2, keepdims=True) | |
# Currently, the GPU implementation of SVD is awful. | |
# It is slower than moving data back to CPU to SVD there |
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
''' | |
Compatible with Keras, faster than reading from files (no stats). | |
It's only designed to work if all your images are vaguely similar sizes/ | |
when encoded as JPGS, so if you have: | |
white noise or other hard-to-encode stuff | |
radically varying image sizes | |
... | |
(probably other failure modes) | |
Then this is foolhardy. |
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
header = r''' | |
\begin{tikzpicture}[node distance = 2mm, auto] | |
%% Auto Generated | |
''' | |
raw_b = r''' | |
\node [block, below= of glove] (conv1) { | |
\begin{tabular}{cc} | |
Conv1D & Input: $n$x100 \\ | |
64x5 Dilation 1 & Output: $n$x64 \\ |
NewerOlder