Skip to content

Instantly share code, notes, and snippets.

View vikramsoni2's full-sized avatar

Vikram vikramsoni2

View GitHub Profile
@vikramsoni2
vikramsoni2 / auc_and_precision_recall_plot.py
Created October 3, 2018 07:45
precision recall and auc plot
def plot_auc_pr(y_test, y_pred):
fig = plt.figure(figsize=(20,7))
plt.subplot(1,2,1)
fpr, tpr, _ = roc_curve(y_test, y_pred)
auc = roc_auc_score(y_test, y_pred)
plt.plot(fpr,tpr,label="auc="+str(auc))
plt.title('roc-auc curve')
plt.legend(loc=4)
@vikramsoni2
vikramsoni2 / xgb_bayes_opt_cv.py
Created November 3, 2017 11:25 — forked from thomasjungblut/xgb_bayes_opt_cv.py
XGBoost hyper parameter optimization using bayes_opt
from bayes_opt import BayesianOptimization
from sklearn.cross_validation import KFold
import xgboost as xgb
def xgbCv(train, features, numRounds, eta, gamma, maxDepth, minChildWeight, subsample, colSample):
# prepare xgb parameters
params = {
"objective": "reg:linear",
"booster" : "gbtree",
"eval_metric": "mae",