[ISL C8-2] Bagging, Random Fore
2021-02-24 本文已影响0人
数科每日
1 Bagging
Recall that given a set of n independent observations Z1, . . . , Zn, each
with variance σ2, the variance of the mean ¯ Z of the observations is given
by σ2/n. In other words, averaging a set of observations reduces variance.
利用多个模型取均值, 来降低方差。
- 先用 Bootstrap 方法生成B的 Training 数据包
- 用B个数据包分别去训练,得到 B个模型
- 回归树取 B 个模型的均值作为结果
- Classification 用投票机制
2 Random Forests
是对Bagging 的改进, 避免了某个影响很强的变量对模型施加过大的影响。 改进之处在于:
- 每次split branch 的时候, 随机使用 p 个predctors 种的 m 个。 一般来说
3 Boosting
- 先用 Bootstrap 方法生成B的 Training 数据包
- 搞一个 Null 函数
- 从 Null 函数开始, 每个子树都对上课树的 residual 建模, 依次使用 B个数据包中的一个, 整个过程有 B 轮
- 最后输出模型
Boosting 注意事项
- B 的数量可能导致 Boosting 过拟合, 一般需要用 Cross Validation 选出 B。
- 控制学习率, 一般在(0.01-0.001), \lambda$就需要越多的B。
- d 是每棵树split 的次数, 一般选 d=1, 也就是每棵树都是一个树桩。