1、XGBoost算法原理:
关于XGBoost算法的原理部分,有兴趣的可以去看XGBoost的论文和陈天奇的PPT。
对英文有障碍的朋友可以去看刘建平博客总结的非常好。
2、XGBoost库比较:
XGBoost有2种Python接口风格。一种是XGBoost自带的原生Python API接口,另一种是sklearn风格的API接口,两者的实现是基本一样的,仅仅有细微的API使用的不同,主要体现在参数命名上,以及数据集的初始化上面。
xgboost库要求我们必须要提供适合的Scipy环境,如果你是使用anaconda安装的Python,你的Scipy环境应该是没有什么问题。
#windows安装
pip install xgboost #安装xgboost库
pip install --upgrade xgboost #更新xgboost库
#导入库
import xgboost as xgb
现在,我们有两种方式可以来使用我们的xgboost库。
第一种方式,是直接使用xgboost库自己的建模流程。
DMatrix
xgboost.DMatrix(data, label=None, weight=None, base_margin=None, missing=None, silent=False, feature_names=None, feature_types=None, nthread=None)
params
params {
eta, gamma, max_depth, min_child_weight, max_delta_step, subsample, colsample_bytree,
colsample_bylevel, colsample_bynode, lambda, alpha, tree_method string, sketch