This file contains hidden or 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
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) |
This file contains hidden or 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 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", |
NewerOlder