Skip to content

Instantly share code, notes, and snippets.

View GabrielSGoncalves's full-sized avatar
🏀
Data Engineer @ Big Data

GabrielSGoncalves GabrielSGoncalves

🏀
Data Engineer @ Big Data
View GitHub Profile
@xiaowei1234
xiaowei1234 / scorers.py
Last active October 1, 2020 12:58
binary classification scorers
import numpy as np
import pandas as pd
from scipy.stats import ks_2samp
from sklearn.metrics import make_scorer, roc_auc_score, log_loss
from sklearn.model_selection import GridSearchCV
def ks_stat(y, yhat):
return ks_2samp(yhat[y==1], yhat[y!=1]).statistic
@cwidmer
cwidmer / compressed_pickle.py
Last active August 22, 2021 06:19
save/load compressed pickled objects in python
import cPickle
import bz2
def save(filename, myobj):
"""
save object to file using pickle
@param filename: name of destination file
@type filename: str