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 | |
combos = [] | |
def generate(remainder, n, current_combo=[], i=0, step=0.1): | |
if n == 1: | |
combos.append(np.round(current_combo + [remainder], 1)) | |
return | |
for p in np.arange(step, remainder - (n-2) * step - step / 10, step): |
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 math | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from scipy import stats | |
# Generate some data | |
a = 1.99 |
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
curl -O https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh | |
bash Anaconda3-5.1.0-Linux-x86_64.sh # Say "yes" and "yes" | |
anaconda3/bin/pip install kaggle | |
anaconda3/bin/pip install lightgbm | |
mkdir .kaggle | |
echo "{"username":"maxhalford", "key":"secret"}" >> ~/.kaggle/kaggle.json | |
chmod 600 ~/.kaggle/kaggle.json |
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 | |
goal_fracs = np.array([.1, .9]) | |
goal_fracs = np.array([.04, .04, .11, .14, .67]) | |
counts = np.zeros_like(goal_fracs) | |
n = 1 | |
tol = .001 | |
a = 0 |
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 | |
class EvalCallback(keras.callbacks.Callback): | |
def __init__(self, X_val, y_val, metric): | |
super().__init__() | |
self.X_val = X_val | |
self.y_val = y_val | |
self.metric = metric |
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 itertools | |
df = pd.DataFrame({ | |
'a': [1, 0, 0, 0], | |
'b': [0, 1, 0, 0], | |
'c': [0, 0, 1, 0], | |
'd': [0, 0, 0, 1], | |
'e': [1, 1, 0, 0], |
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 glob | |
import imageio | |
from keras import layers | |
from keras import losses | |
from keras import models | |
from keras import optimizers | |
import numpy as np | |
import pandas as pd |
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 itertools | |
from keras import layers as l | |
from keras import models as m | |
from keras import preprocessing as p | |
import numpy as np | |
import pandas as pd | |
def generate_series(paths, prepare, chunk_size=1e6): |
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
""" | |
Rating percentage index (RPI). | |
Example taken from https://www.wikiwand.com/en/Rating_percentage_index#/Basketball_formula | |
""" | |
X = pd.DataFrame( | |
data=[ | |
(2010, 'UConn', 64, 'Kansas', 57), | |
(2010, 'UConn', 82, 'Duke', 68), |
