Tianchi - industry forecast summary -XGBoost

The competition website  https://tianchi.aliyun.com/competition/entrance/231693/information

The title match analysis  https://www.jianshu.com/p/f15e01d377ef?utm_campaign=haruki  paper selected some mainstream machine learning models to predict the test results, the final choice random forest.

His reference to the results of the model, random forests are more stars a separate tree, in improving the selection of two years when the race results were significant XGBoost.

 

xgboost popular understanding, for example return to xgboost

Difficult to guarantee the accuracy of a single tree, a single tree is assumed predicted y ', the true value y, then an error is generated y-y',

xgboost for this error has also established a decision tree analysis of the causes of error, to make up for the error, the new decision tree will produce an error, then continue to build a decision tree, so go iteration, which is roughly xgboost process.

This process is like we write code, we'll generally write a framework, run it and see what is wrong, change it, run it and see what is wrong, and then change it, so iterations, until completely correct. Note that we write the code from scratch wrote little about the tail, because it is very easy to debug, if too many errors, might as well re-write, correspond to the decision tree is a tree too deep, too fit, you may need to re-train, so xgboost every tree not too deep.

 

xgboost theory and mathematical derivation, refer to the following two blog

https://blog.csdn.net/lukeyyanghang/article/details/87914428

https://www.cnblogs.com/zongfa/p/9324684.html

 

XGBoost core application code is as follows , features no longer part of the project analysis.

Training model parameters Results

 

关于XGBoost中参数意义及训练方法 可以参考此篇 https://blog.csdn.net/u010665216/article/details/78532619

特别作者提到 “不要幻想仅仅通过参数调优或者换一个稍微更好的模型使得最终结果有巨大的飞跃。要想最后的结果有巨大的提升,可以通过特征工程、模型集成来实现。” 深以为然。

另外模型中涉及到的sklearn交叉验证,这篇博客有比较系统的说明供参考https://blog.csdn.net/luanpeng825485697/article/details/79836262

 

这里也顺便补充一下另一个大杀器lightgbm吧

传统的boosting算法(如GBDT和XGBoost)已经有相当好的效率,但是在如今的大样本和高维度的环境下,传统的boosting似乎在效率和可扩展性上不能满足现在的需求了,主要的原因就是传统的boosting算法需要对每一个特征都要扫描所有的样本点来选择最好的切分点,这是非常的耗时。为了解决这种在大样本高纬度数据的环境下耗时的问题,Lightgbm使用了如下两种解决办法:一是GOSS(Gradient-based One-Side Sampling, 基于梯度的单边采样),不是使用所用的样本点来计算梯度,而是对样本进行采样来计算梯度;二是EFB(Exclusive Feature Bundling, 互斥特征捆绑) ,这里不是使用所有的特征来进行扫描获得最佳的切分点,而是将某些特征进行捆绑在一起来降低特征的维度,是寻找最佳切分点的消耗减少。这样大大的降低的处理样本的时间复杂度,但在精度上,通过大量的实验证明,在某些数据集上使用Lightgbm并不损失精度,甚至有时还会提升精度。

详细原理:https://blog.csdn.net/qq_24519677/article/details/82811215

主要关注应用,调参原理

1 针对 Leaf-wise(Best-first)树的参数优化

(1)num_leaves这是控制树模型复杂度的主要参数。理论上, 借鉴 depth-wise 树, 我们可以设置 num_leaves= 2^{(max\_depth)}  但是, 这种简单的转化在实际应用中表现不佳. 这是因为, 当叶子数目相同时, leaf-wise 树要比 depth-wise 树深得多, 这就有可能导致过拟合. 因此, 当我们试着调整 num_leaves 的取值时, 应该让其小于2^{(max\_depth)} . 举个例子, 当 max_depth=7时,depth-wise 树可以达到较高的准确率.但是如果设置 num_leaves 为 128 时, 有可能会导致过拟合, 而将其设置为 70 或 80 时可能会得到比 depth-wise 树更高的准确率. 其实, depth 的概念在 leaf-wise 树中并没有多大作用, 因为并不存在一个从 leaves 到 depth 的合理映射。

(2)min_data_in_leaf. 这是处理 leaf-wise 树的过拟合问题中一个非常重要的参数. 它的值取决于训练数据的样本个树和 num_leaves. 将其设置的较大可以避免生成一个过深的树, 但有可能导致欠拟合. 实际应用中, 对于大数据集, 设置其为几百或几千就足够了。

(3)max_depth(默认不限制,一般设置该值为5—10即可) 你也可以利用 max_depth 来显式地限制树的深度。

2 针对更快的训练速度

(1)通过设置 bagging_fraction 和 bagging_freq 参数来使用 bagging 方法;

(2)通过设置 feature_fraction 参数来使用特征的子抽样;

(3)使用较小的 max_bin;

(4)使用 save_binary 在以后的学习过程对数据进行加速加载。

3 针对更好的准确率

(1)使用较大的 max_bin (学习速度可能变慢);

(2)使用较小的 learning_rate 和较大的 num_iterations;

(3)使用较大的 num_leaves (可能导致过拟合);

(4)使用更大的训练数据;

(5)尝试 dart(一种在多元Additive回归树种使用dropouts的算法).

4 处理过拟合

(1)使用较小的 max_bin(默认为255)

(2)使用较小的 num_leaves(默认为31)

(3)使用 min_data_in_leaf(默认为20) 和 min_sum_hessian_in_leaf(默认为)

(4)通过设置 bagging_fraction (默认为1.0)和 bagging_freq (默认为0,意味着禁用bagging,k表示每k次迭代执行一个bagging)来使用 bagging

(5)通过设置 feature_fraction(默认为1.0) 来使用特征子抽样

(6)使用更大的训练数据

(7)使用 lambda_l1(默认为0), lambda_l2 (默认为0)和 min_split_gain(默认为0,表示执行切分的最小增益) 来使用正则

(8)尝试 max_depth 来避免生成过深的树
 

发布了10 篇原创文章 · 获赞 2 · 访问量 1794

Guess you like

Origin blog.csdn.net/weixin_41814051/article/details/104266554