将弱者组合成强大的分类器 [英] Combining Weak Learners into a Strong Classifier

查看:195
本文介绍了将弱者组合成强大的分类器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将少数弱学习者组合为强分类器?我知道公式,但是问题在于,在我阅读的有关AdaBoost的每篇论文中,都只有公式,而没有任何示例.我的意思是-我的学习者及其体重较弱,所以我可以按照公式告诉我的做(将学习者乘以其体重,再乘以一个乘以其体重,再乘以另一个,等等),但是我该怎么做呢?我的弱者是决策树桩.他们拥有属性和门槛,那我要乘以什么?

How do I combine few weak learners into a strong classifier? I know the formula, but the problem is that in every paper about AdaBoost that I've read there are only formulas without any example. I mean - I got weak learners and their weights, so I can do what the formula tells me to do (multiply learner by its weight and add another one multiplied by its weight and another one etc.) but how exactly do I do that? My weak learners are decision stumps. They got attribute and treshold, so what do I multiply?

推荐答案

如果我正确理解了您的问题,那么在这些讲义中,您对如何增强将弱分类器编码为具有大量图像的强分类器有了很好的解释:

If I understand your question correctly, you have a great explanation on how boosting ensambles the weak classifiers into a strong classifier with a lot of images in these lecture notes:

www.csc.kth. se/utbildning/kth/kurser/DD2427/bik12/DownloadMaterial/Lectures/Lecture8.pdf

基本上,您是通过对分离的超平面进行加权组合来创建更复杂的决策面(在讲义中显示了较大的图)

Basically you are by taking the weighted combination of the separating hyperplanes creating a more complex decision surface (great plots showing this in the lecture notes)

希望这会有所帮助.

编辑

要切实做到这一点:

中,您可以看到alpha_t = 1/2*ln((1-e_t)/e_t)的公式,这些公式可以很容易地在for循环中计算出来,或者如果您使用向量运算直接使用某些数字库(我使用的是numpy确实很棒). alpha_t是在adaboost内部计算的,因此我假设您已经拥有这些.

in page 42 you see the formulae for alpha_t = 1/2*ln((1-e_t)/e_t) which easily can be calculated in a for loop, or if you are using some numeric library (I'm using numpy which is really great) directly by vector operations. The alpha_t is calculated inside of the adaboost so I assume you already have these.

您具有第38页的数学公式,大西格马表示总和. h_t是弱分类器函数,它返回-1(否)或1(是). alpha_t基本上是弱分类器的性能如何,因此在强分类器的最终决定(不是很民主)中必须说多少.

You have the mathematical formulae at page 38, the big sigma stands for sum over all. h_t is the weak classifier function and it returns either -1 (no) or 1 (yes). alpha_t is basically how good the weak classifier is and thus how much it has to say in the final decision of the strong classifier (not very democratic).

我从来没有真正使用过forloops,但是我会更容易理解和更独立于语言(这是pythonish伪代码):

I don't really use forloops never, but I'll be easier to understand and more language independent (this is pythonish pseudocode):

strongclassifier(x):
    response=0
    for t in T: #over all weakclassifiers indices
        response += alpha[t]*h[t](x)
    return sign(response)

这在数学上称为权重与弱响应之间的点积(基本上是:strong(x)= alpha * weak(x)).

This is mathematically called the dot product between the weights and the weak-responses (basically: strong(x) = alpha*weak(x)).

http://en.wikipedia.org/wiki/Dot_product

EDIT2

这是在strongclassifier(x)内部发生的事情: 分离超平面基本上由函数weak(x)决定,因此所有具有weak(x)= 1的x都在超平面的一侧,而weak(x)=-1则在超平面的另一侧.如果考虑在平面上有线,则有一个平面将平面分为两部分(始终),一侧是(-),另一侧是(+).如果您现在有3条三角形的无限线且其负边朝外,则三角形内部为3(+),外部为1或2(-)(在强分类器中)变成一个三角形区域,该区域为正,其余为负.这是一个过分的简化,但要点仍然存在,并且在更高的维度上完全类似.

This is what is happening inside strongclassifier(x): Separating hyperplane is basically decided in the function weak(x), so all x's which has weak(x)=1 is on one side of the hyperplane while weak(x)=-1 is on the other side of the hyperplane. If you think about it has lines on a plane you have a plane separating the plane into two parts (always), one side is (-) and the other one is (+). If you now have 3 infinite lines in the shape of a triangle with their negative side faced outwards, you will get 3 (+)'s inside the triangle and 1 or 2 (-)'s outside which results (in the strong classifier) into a triangle region which is positive and the rest negative. It's an over simplification but the point is still there and it works totally analogous in higher dimensions.

这篇关于将弱者组合成强大的分类器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆