您的位置:首页 > 其它

[机器学习入门] 李宏毅机器学习笔记-35(Ensemble part 1;集成方法 part 1)

2017-08-02 23:27 423 查看
[机器学习入门] 李宏毅机器学习笔记-35(Ensemble;集成方法)

PDFVIDEO

Ensemble

俗称打群架,想要得到很好的performance,基本都要用这一手。

You already developed some algorithms and codes.Lazy to modify them.Ensemble: improving your machine with little modification.

Feamework of Ensemble

揪出一堆classifiers,最好是不同的,互补的,妥当地把他们集合起来,每一个classifier都扮演着不同的角色。



Ensemble 有很多不同的方法,是为了对待不同的状况。

Ensemble: Bagging

先回顾一下Bias和Variance



A complex model will have large variance.

We can average complex models to reduce variance.

If we average all the f*,is it close to f^.

所以,如果想让一个variance很大的model的error变小,可以训练好多个variance很大的model,然后把它们平均起来,这个方法就叫做Bagging。



Sampling N’ examples with replacement,then……



This approach would be helpful when your model is complex, easy to overfit. e.g. decision tree.

Decision Tree

决策树很容易过拟合,模型很easy。



决策树不仅仅能判断上图的简单问题,还能解决很多复杂问题。

比如……下图这个美少女,把初音的身体代表类别1,其他叫类别0,在这个二维平面上的值,就是input,来output判断是否在初音的身体上。



不同树深的实验表现



到这里很容易理解,决策树继续深下去完全可以做到training data上的完美,因为大不了它可以给每一个data分一个类,显而易见,这样很容易过拟合。

Decision Tree做 bagging 就是 Random Forest。

Random Forest



增加一些随机的特性,使树与树之间更不像。

每一次分出节点时,都要决定一下哪些feature 是可以用的,哪些是不可以用的,避免每一个树都长的很像。

有个bagging方法叫做Out-of-bag。

Out-of-bag(OOB)





bagging的目标不是在 training data 上的到更好的表现,而是让bias减小,得到的function更加平滑(初音的肌肤更加细腻)。



Ensemble: Boosting

Boosting 的目标和 Bagging 是相反的,Bagging是把减弱过拟合,而 Boosting 是即使不能 fit training data 的 model,也要想办法使 performance 更好,Boosting 通过把很多弱的 Classifiers结合起来,帮助得到强的 Classifiers。



就好比说,只要一个算法能比瞎猜好一点点,就能通过boosting变成一个超强的算法。

需要注意的是:The classifiers are learned sequentially.

How to obtain different classifiers?

不同的classifier通过在不同的 training data上做训练,不同的 training data 怎么得到呢?



Re-weighting 能使sample的次数不是整数而是小数。

Adaboost

The performance of f1 for new weights would be random.



举个栗子

Re-weighting Training Data



就比如,错的题分值变大,对的题分值变小,75分硬生生整成不及格。

How to find a new training set that fails f1 x ?



What is the value of d1?





答对的weight是Z1(1-ε1),答错的weight是Z1ε1,所有答错的weight都会被乘上d1,所有答对的weight都会被除上d1,对错相等列不等式。

Algorithm for AdaBoost

下接 part 2
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐