def ExtGBDT(train_x, train_y, test_x, test_y):
""" Ext-GBDT """
num_round = 100
param = {'objective': 'binary:logistic', 'booster': 'gbtree', 'eta': 0.03, 'max_depth': 3, 'eval_metric': 'auc',
'silent': 1, 'min_child_weight': 0.1, 'subsample': 0.7, 'colsample_bytree': 0.8, 'nthread': 4,
'max_delta_step': 0}
train_X = xgb.DMatrix(train_x, train_y)
test_X = xgb.DMatrix(test_x)
bst = xgb.train(param, train_X, num_round)
pred = bst.predict(test_X)
predict_y = []
for i in range(len(pred)):
if pred[i] < 0.5:
predict_y.append(0)
else:
predict_y.append(1)
auc = evaluate_auc(pred, test_y)
evaluate(predict_y, test_y)
return auc
评论列表
文章目录