文章目录
1. Decision Trees (决策树)
优点
- Explainable (可解释性)
- Can handle both numerical and categorical features (数值与分类特征)
缺点
- Very non-robust(unsemble to help) (鲁棒性很底)
- complex trees cause overfitting(prune trees) (复杂的树容易过拟合)
- not easy to be parallelized in computing (很难并行)
2. Random Forest (随机森林)
(多个决策树的集合:单独训练,投票得到结果)
-
train multiple decision trees to improve robustness
- each tree is trained independently
- majority voting for classification, averiage for regression
-
where is the randomness from
- Bagging: randomly sample training examples with replacement
- e.g. 【1,2,3,4,5】 -》【1,2,2,3,4】
- Randomly select a subset of features
- Bagging: randomly sample training examples with replacement
-
train step
- randomly sample training examples (随机采样)
- random select a subset of features(随机选取属性做节点分裂属性)
- repeat step 2 until no subsets exists(重复步骤2,直到不能再分裂)
- constructs large mounts of decision trees to formulate a randm forest(构建大量决策树形成深林)
-
e.g.: (例子)
- 一个样本容量为N的样本,有放回的抽取N次,每次抽取1个,最终形成了N个样本。这选择好了的N个样本用来训练一个决策树,作为决策树根节点处的样本。
- 当每个样本有M个属性时,在决策树的每个节点需要分裂时,随机从这M个属性中选取出m个属性,满足条件m << M。然后从这m个属性中采用某种策略(比如说信息增益)来选择1个属性作为该节点的分裂属性。
- 决策树形成过程中每个节点都要按照步骤2来分裂(很容易理解,如果下一次该节点选出来的那一个属性是刚刚其父节点分裂时用过的属性,则该节点已经达到了叶子节点,无须继续分裂了)。一直到不能够再分裂为止。注意整个决策树形成过程中没有进行剪枝。
- 按照步骤1~3建立大量的决策树,这样就构成了随机森林了。
-
优点
- 它可以出来很高维度(特征很多)的数据,并且不用降维,无需做特征选择
- 它可以判断特征的重要程度
- 可以判断出不同特征之间的相互影响
- 不容易过拟合
- 训练速度比较快,容易做成并行方法
- 实现起来比较简单
- 对于不平衡的数据集来说,它可以平衡误差。
- 如果有很大一部分的特征遗失,仍可以维持准确度.
-
缺点
- 随机森林已经被证明在某些噪音较大的分类或回归问题上会过拟合。
- 对于有不同取值的属性的数据,取值划分较多的属性会对随机森林产生更大的影响,所以随机森林在这种数据上产出的属性权值是不可信的
3. Gradient Boosting Decision Trees(梯度提升决策树)
下面这篇知乎专栏非常详细地讲解了GBDT的基础知识
https://zhuanlan.zhihu.com/p/64863699
-
train step
- train multiple trees sequentially (串行运行一系列树)
- at step t = 1,…, denote by F t ( x ) F_t(x) Ft(x) the sum of past trained trees
- train a new tree f t f_t ft on residuals : { ( x i , y i F t ( x i ) ) } i {(x_i, y_i - F_t(x_i))}_i {(xi,yiFt(xi))}i (将残差拿出来进行训练一颗新的树,和ResNet的思路有些类似)
- F t + 1 ( x ) = F t ( x ) + f t ( x ) F_{t+1}(x) = F_t(x) + f_t(x) Ft+1(x)=Ft(x)+ft(x)
- The residual equals to L / F -partial L / partial F L/F if using mean square error is the loss, So it’s called gradient boosting.
(平均误差的时候 y i F t ( x i ) = L F y_i - F_t(x_i) = - rac{partial{L}}{partial{F}} yiFt(xi)=FL)
-
优点
- 预测阶段速度快,树与树之间可以并行预测
- 在数据分布稠密的数据上,泛化能力和表征能力都很好
- 使用 CART 作为弱分类器不需要对数据进行特殊的预处理如归一化等
-
局限性
- 在高维稀疏的数据上,表现不如 SVM 或神经网络
- 训练过程需要串行训练,只能在决策树内部采用一些局部并行手段提高训练速度
4. Summary
- Decision tree : an explainable model for classification/regression(简单)
- Ensembel trees to reduce bias an variance (随机森林/GBDT)
- random forest: trees trained in parallel with randomness
- gradient boosting trees:train in sequential on residuals
- Trees are widely used in industy(生产应用广泛)
- simple,easy to tune , often gives statisfied results