Skip to content

Instantly share code, notes, and snippets.

@MaxHalford
MaxHalford / lgbm_tree_outputs.py
Created October 15, 2019 08:37
LightGBM tree outputs
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)
@MaxHalford
MaxHalford / Sampling.ipynb
Created December 19, 2019 21:16
Over/under/hybrid sampling a stream
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MaxHalford
MaxHalford / bayesian-lin-reg.ipynb
Created February 26, 2020 16:46
Bayesian linear regression
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MaxHalford
MaxHalford / mean.py
Last active March 25, 2020 11:09
creme mean
>>> from creme import stats
>>> mean = stats.Mean()
>>> mean.update(5)
>>> mean.update(10)
>>> mean
7.5
>>> mean.update(6)
@MaxHalford
MaxHalford / target_agg.py
Created March 25, 2020 11:10
creme target encoding
>>> 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}
@MaxHalford
MaxHalford / phishing.py
Last active April 5, 2020 08:28
creme Phishing
>>> from creme import compose
>>> from creme import datasets
>>> from creme import linear_model
>>> from creme import metrics
>>> from creme import preprocessing
>>> X_y = datasets.Phishing()
>>> model = compose.Pipeline(
... preprocessing.StandardScaler(),
@MaxHalford
MaxHalford / results.csv
Created March 25, 2020 12:53
Linear regression benchmarks
Library Method MSE Average fit time Average predict time
creme LinearRegression 23.035085 18μs 4μs
Keras on TF (CPU) Dense 23.035086 1ms208μs 722μs
PyTorch (CPU) Linear 23.035086 577μs 187μs
scikit-learn SGDRegressor 25.295369 305μs 108μs
@MaxHalford
MaxHalford / scikit-learn-faster-predictions.ipynb
Created March 31, 2020 10:15
Improving scikit-learn's single prediction speed
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MaxHalford
MaxHalford / zixor_analysis.ipynb
Created April 15, 2020 14:33
Analysis of the Zixor card from Hearthstone
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.