您的位置:首页 > 其它

XGBoost的参数使用说明

2018-12-24 16:50 99 查看

直接调用XGBoost
–import xgboost as xgb

与scikit-learn一起使用
– from xgboost import XGBClassifier

其使用的步骤:

     • 1. 构造学习器实例
         – 模型参数在构造时传递
     • 2. 模型训练:fit/GridSearchCV
     • 3. 预测

• xgboost.XGBClassifier(max_depth=3, learning_rate=0.1,
n_estimators=100, silent=True, objective=‘binary:logistic’, nthread=-1,
gamma=0, min_child_weight=1, max_delta_step=0, subsample=1,
colsample_bytree=1, colsample_bylevel=1, reg_alpha=0, reg_lambda=1,
scale_pos_weight=1, base_score=0.5, random_state=0, seed=None,
missing=None,**kwargs)
• fit(X, y, sample_weight=None, eval_set=None, eval_metric=None, early_st
opping_rounds=None, verbose=True, xgb_model=None)

 

 

 

 Kaggle竞赛优胜者的建议
• Tong He(XGBoost R语言版本开发者): 三个最重要的
参数为:树的数目、树的深度和学习率。建议参数调整策
略为:
– 采用默认参数配置试试
– 如果系统过拟合了,降低学习率
– 如果系统欠拟合,加大学习率

 

具体调参可以参考https://www.geek-share.com/detail/2679891925.html

 

关于XGBoost参数的调节步骤:

1.选择一组初始化参数,确定n_estimators也就是树的棵数

2.改变max_depth也就是树的深度和min_child_weight也就是节点权重的和

3.改变reg_alpha和reg_lambda

4.调节subsample和colsample-bytree改变数据采样策略

5.改变learning_rate(变小)同时增大n_estimators的值.

6.确定模型.

 

 

 

 

 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: