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
""" | |
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), |
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 lightgbm as lgb | |
from sklearn import datasets | |
from sklearn import model_selection | |
X, y = datasets.load_boston(return_X_y=True) | |
X_fit, X_val, y_fit, y_val | |
model = lgb.LGBMRegressor() | |
model.fit(X_fit, y_fit) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
>>> from creme import stats | |
>>> mean = stats.Mean() | |
>>> mean.update(5) | |
>>> mean.update(10) | |
>>> mean | |
7.5 | |
>>> mean.update(6) |
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 creme import feature_extraction | |
>>> from creme import stats | |
>>> X = [ | |
... {'place': 'Taco Bell', 'revenue': 42}, | |
... {'place': 'Burger King', 'revenue': 16}, | |
... {'place': 'Burger King', 'revenue': 24}, | |
... {'place': 'Taco Bell', 'revenue': 58}, | |
... {'place': 'Burger King', 'revenue': 20}, | |
... {'place': 'Taco Bell', 'revenue': 50} |