XGBoost中的超参数调整

时间:2017-07-22 22:07:43

标签: python scikit-learn xgboost grid-search hyperparameters

我正在尝试在XGBoost中进行参数调整。但是,当我运行代码时,它会卡住并且永远不会完成。我使用的数据集有50000行和35列。我做错了什么还是计算量太大了?

param_test1 = [{
 'max_depth':[3],
 'min_child_weight':[3]
}]

gsearch1 = GridSearchCV(estimator = XGBClassifier(learning_rate =0.1, n_estimators=140, max_depth=5,
                                              min_child_weight=1, gamma=0, subsample=0.8, colsample_bytree=0.8,
                                              objective= 'binary:logistic', nthread=4, scale_pos_weight=1, seed=27), 
                    param_grid = param_test1, scoring='roc_auc',n_jobs=4,iid=False, cv=5)

target = 'AntAktAvtBank'
predictors = [x for x in dtrain.columns if x not in [target, ID_col]]
gsearch1.fit(dtrain[predictors],dtrain[target])
gsearch1.grid_scores_, gsearch1.best_params_, gsearch1.best_score_

0 个答案:

没有答案