非技术性的 Adaboost 算法演练
Adaboost Algorithm Walkthrough for non-technical
我看了这些问题here and here. But i still couldn't find a satisfactory result for me to understand the algorithm. I understood what it does, and the general idea on how it does it, but still i don't feel comfortable enough to use it in projects. I would like to understand how the algorithm corresponds to the more colloquial description of it. I tried reading several online sources, but most of them keep reproducing the examples of Schapire and Freund without really explaining what is going on. Here is the algorithm given in Schapire's Explaining AdaBoost, p. 2
这是我到目前为止的理解:
x1,y2,对应训练集
当给定 x1 时,我们观察到 y1 输出。
这个x+号码是X集合的成员。
y+number 是 set {-1,+1}
的成员,所以对于算法的其余部分
训练集是 (x+number,-1),(x+number,+1), xm, -1 or +1)
等等
初始化分布,这里分布的意义不是很清楚但是我们继续
D1(i) = 1/m for i = 1, ..., m
.
我不确定D1的1和1/m的1有没有关系,但据我了解,i对应于训练集中元素的位置。
我假设 t 的意思是时间或实例之类的东西,所以我们 t1 实例和 t2 实例等
通过说使用分布 Dt 训练弱学习器,我假设我们想做类似 Dt(i) = t/m
?
的事情
得到弱假设 ht: X -> {-1,+1}
意味着 ht 是这样的,如果它从 X 组输入中获取一个元素,那么它将给出 {-1,+1}
作为输出。
目标:select ht 低加权误差:
我真的不明白这里发生了什么。符号“~”通常对应于逻辑运算符中的 "not" 或有时用作日期中的 circa 的等价物,但我认为这里不是这种情况,它是否对应于我给定 Dt 的概率之类的东西?
开头的"et"我一开始以为是熵,但是看了here其实是错误的。 “[”表示矩阵? ht(xi) != yi 表示 ht 为输入 xi 产生了错误的输出,因为通常训练集定义为 x1,y1,xm,ym 等。
对于算法的其余部分,我不知道。如果有人能用非技术术语解释其余部分,那就太好了。非技术性的,我的意思是试图描述算法在每个步骤中相对于上一步的作用。如果您还可以解释一下为什么使用 "ln" 和 "sign" 之类的函数来描述正在发生的事情,那就太好了。如果您可以用更具体的东西替换变量,那也很好。
PS: 我添加了代码格式的符号,因为在接受问题之前坚持我的问题包含代码
This x+number is a member of X set.
And y+number is a member of set {-1,+1} so for the rest of the algorithm the training set is (x+number,-1),(x+number,+1), xm, -1 or +1) etc.
Initialize the distribution, not sure about the sense of distribution here but let's carry on.
似乎是正确的。
分布感是一个离散的概率质量函数。
D1(i) = 1/m for i = 1, ..., m.
I am not sure if there is any relation between the 1 of D1 and the 1 of 1/m, but as far as i understand the i corresponds to the position of the element in the training set.
没有那样的关系。是的,这就是 i
的意思。
I assume t means, something like time or instance, so that we t1 instance and t2 instance, etc.
是的,它是 "time" 或更准确地说是迭代次数,即将使用的弱学习器的数量。
By saying Train weak learner using distribution Dt, i assume we want to do something like Dt(i) = t/m ?
不绝对不是。想一想 Adaboost 的作用:它通过迭代构建弱学习器将弱学习器组合成强学习器,这种方式(比如)k
th 弱学习器可以补偿之前的学习器。概率分布是对每个弱学习器的 数据实例 进行加权,因此当前弱学习器集合较差的 x
的实例被认为更强烈较新的弱学习者。
Get weak hypothesis ht: X -> {-1,+1} meaning that ht is so that if it takes an element from X set of inputs then it would give {-1,+1} as output.
Aim: select ht with low weighted error:
I don't really get what's going on here. The sign "~" usually corresponds to "not" in logical operators or sometimes used as an equivalent of circa in dates but i assume that is not the case here, does it correspond to something like Probability of i given Dt ?
没有。事实上,~
在*编程语言中是 "not"”,但在数学中并非如此(通常是等价关系)。特别是,在概率上,它意味着 "distributed as"。
The "et" at the beginning is i thought enthropy at first, but i read here that it is actually error. The "[" for indicating a matrix? ht(xi) != yi means that the ht produces the wrong output for the input xi, because normally the training set is defined like x1,y1,xm,ym and such.
For the remainder of the algorithm i have no idea. It would be great if someone can explain the rest in non technical terms. By non technical, i mean by trying to describe what the algorithm does in each step with respect to the previous step. It would be great if you can also give some explanation to why functions like "ln" and "sign" are used to describe what is going on. It would also be great if you can substitute the variables with something that is a little more concrete.
这里有很多误解。我将尝试描述剩余的步骤(但我确实建议最终只阅读原始论文)。
-> 计算误差
\epsilon_t = Pr_{i~D_t}[ h_t(x_i) != y_i ]
这就是它的字面意思:第 t
个弱学习器在数据点 x_i
上出错的概率。我猜这是令人困惑的,因为它是 weighted 概率,因此具有高 D_t
的点更有可能被选择,因此对此处的概率度量贡献更大。因此,从本质上讲,我们只是通过查看其在整个数据集中的错误来估计 h_t
的性能(但考虑到一些示例比其他示例更重要,特别是那些我们做得不好的示例)。
-> 估计权重因子
alpha_t = ln[ (1 - \epsilon_t) / \epsilon_t ] / 2
正如反复提到的那样,我们正在尝试让新的弱学习器在我们之前的其他弱学习器(较低 t
)失败的数据示例上做得更好。
这个alpha_t
是权重因子的一部分。注意:如果误差为 1(即字面意思是最差的可能),则权重非常小;这意味着 "pay less attention to the stupid learners".
最终,当我们将所有弱学习器组合在一起时,我们将不得不对它们进行加权,因为有些人会比其他人做得更好,因此应该更认真地听取他们的意见。这就是 alpha_t
衡量的
ln
的确切形式的原因是数学上的;证明最佳权重(给定一些合理的假设,例如指数损失)确实是给定的形式是相当容易的(see here)。但这对你来说不是那么重要,现在。
->更新概率分布(即数据点加权函数):
D_{t+1}(i) = [D_t(i) exp(-alpha_t y_i h_t(x_i))] / Z_t
同样,我们希望 "hard" 个样本的权重更大。那么,看看这个表达式的形式。我们正在更新 x_i
的概率质量。这取决于
D_t(i)
:x_i
的前次概率值(如果以前很重要,现在应该也很重要)
alpha_y
:弱学习器的权重函数(更高权重的学习器意味着这个x_i
的概率质量变化会更强)
y_i h_t(x_i)
:注意如果学习者错了则y_i h_t(x_i)=-1
,否则y_i h_t(x_i)=1
。在前一种情况下,-alpha_t y_i h_t(x_i)
将为正(因此 exp(-alpha_t y_i h_t(x_i))
会很大);在后者中,负数(所以 exp(-alpha_t y_i h_t(x_i))
会很小)。因此,这意味着我们将在 错误 时增加实例的概率,并在 正确的 时降低实例的概率。这是有道理的:如果 h_t
在 x_i
上是正确的,那么 h_{t+1}
不应该太在意它;它应该关注 h_t
错误的情况,并努力弥补它!
-> 合并弱学习器
最终的学习者只是弱学习者的加权平均值(由 alpha_t 加权)。就是这样。让我知道这是否有意义。
//(天啊,我真希望有 Latex……)
我看了这些问题here and here. But i still couldn't find a satisfactory result for me to understand the algorithm. I understood what it does, and the general idea on how it does it, but still i don't feel comfortable enough to use it in projects. I would like to understand how the algorithm corresponds to the more colloquial description of it. I tried reading several online sources, but most of them keep reproducing the examples of Schapire and Freund without really explaining what is going on. Here is the algorithm given in Schapire's Explaining AdaBoost, p. 2
这是我到目前为止的理解:
x1,y2,对应训练集
当给定 x1 时,我们观察到 y1 输出。
这个x+号码是X集合的成员。
y+number 是 set {-1,+1}
的成员,所以对于算法的其余部分
训练集是 (x+number,-1),(x+number,+1), xm, -1 or +1)
等等
初始化分布,这里分布的意义不是很清楚但是我们继续
D1(i) = 1/m for i = 1, ..., m
.
我不确定D1的1和1/m的1有没有关系,但据我了解,i对应于训练集中元素的位置。
我假设 t 的意思是时间或实例之类的东西,所以我们 t1 实例和 t2 实例等
通过说使用分布 Dt 训练弱学习器,我假设我们想做类似 Dt(i) = t/m
?
的事情
得到弱假设 ht: X -> {-1,+1}
意味着 ht 是这样的,如果它从 X 组输入中获取一个元素,那么它将给出 {-1,+1}
作为输出。
目标:select ht 低加权误差:
我真的不明白这里发生了什么。符号“~”通常对应于逻辑运算符中的 "not" 或有时用作日期中的 circa 的等价物,但我认为这里不是这种情况,它是否对应于我给定 Dt 的概率之类的东西?
开头的"et"我一开始以为是熵,但是看了here其实是错误的。 “[”表示矩阵? ht(xi) != yi 表示 ht 为输入 xi 产生了错误的输出,因为通常训练集定义为 x1,y1,xm,ym 等。
对于算法的其余部分,我不知道。如果有人能用非技术术语解释其余部分,那就太好了。非技术性的,我的意思是试图描述算法在每个步骤中相对于上一步的作用。如果您还可以解释一下为什么使用 "ln" 和 "sign" 之类的函数来描述正在发生的事情,那就太好了。如果您可以用更具体的东西替换变量,那也很好。
PS: 我添加了代码格式的符号,因为在接受问题之前坚持我的问题包含代码
This x+number is a member of X set. And y+number is a member of set {-1,+1} so for the rest of the algorithm the training set is (x+number,-1),(x+number,+1), xm, -1 or +1) etc. Initialize the distribution, not sure about the sense of distribution here but let's carry on.
似乎是正确的。 分布感是一个离散的概率质量函数。
D1(i) = 1/m for i = 1, ..., m. I am not sure if there is any relation between the 1 of D1 and the 1 of 1/m, but as far as i understand the i corresponds to the position of the element in the training set.
没有那样的关系。是的,这就是 i
的意思。
I assume t means, something like time or instance, so that we t1 instance and t2 instance, etc.
是的,它是 "time" 或更准确地说是迭代次数,即将使用的弱学习器的数量。
By saying Train weak learner using distribution Dt, i assume we want to do something like Dt(i) = t/m ?
不绝对不是。想一想 Adaboost 的作用:它通过迭代构建弱学习器将弱学习器组合成强学习器,这种方式(比如)k
th 弱学习器可以补偿之前的学习器。概率分布是对每个弱学习器的 数据实例 进行加权,因此当前弱学习器集合较差的 x
的实例被认为更强烈较新的弱学习者。
Get weak hypothesis ht: X -> {-1,+1} meaning that ht is so that if it takes an element from X set of inputs then it would give {-1,+1} as output. Aim: select ht with low weighted error: I don't really get what's going on here. The sign "~" usually corresponds to "not" in logical operators or sometimes used as an equivalent of circa in dates but i assume that is not the case here, does it correspond to something like Probability of i given Dt ?
没有。事实上,~
在*编程语言中是 "not"”,但在数学中并非如此(通常是等价关系)。特别是,在概率上,它意味着 "distributed as"。
The "et" at the beginning is i thought enthropy at first, but i read here that it is actually error. The "[" for indicating a matrix? ht(xi) != yi means that the ht produces the wrong output for the input xi, because normally the training set is defined like x1,y1,xm,ym and such. For the remainder of the algorithm i have no idea. It would be great if someone can explain the rest in non technical terms. By non technical, i mean by trying to describe what the algorithm does in each step with respect to the previous step. It would be great if you can also give some explanation to why functions like "ln" and "sign" are used to describe what is going on. It would also be great if you can substitute the variables with something that is a little more concrete.
这里有很多误解。我将尝试描述剩余的步骤(但我确实建议最终只阅读原始论文)。
-> 计算误差
\epsilon_t = Pr_{i~D_t}[ h_t(x_i) != y_i ]
这就是它的字面意思:第 t
个弱学习器在数据点 x_i
上出错的概率。我猜这是令人困惑的,因为它是 weighted 概率,因此具有高 D_t
的点更有可能被选择,因此对此处的概率度量贡献更大。因此,从本质上讲,我们只是通过查看其在整个数据集中的错误来估计 h_t
的性能(但考虑到一些示例比其他示例更重要,特别是那些我们做得不好的示例)。
-> 估计权重因子
alpha_t = ln[ (1 - \epsilon_t) / \epsilon_t ] / 2
正如反复提到的那样,我们正在尝试让新的弱学习器在我们之前的其他弱学习器(较低 t
)失败的数据示例上做得更好。
这个alpha_t
是权重因子的一部分。注意:如果误差为 1(即字面意思是最差的可能),则权重非常小;这意味着 "pay less attention to the stupid learners".
最终,当我们将所有弱学习器组合在一起时,我们将不得不对它们进行加权,因为有些人会比其他人做得更好,因此应该更认真地听取他们的意见。这就是 alpha_t
衡量的
ln
的确切形式的原因是数学上的;证明最佳权重(给定一些合理的假设,例如指数损失)确实是给定的形式是相当容易的(see here)。但这对你来说不是那么重要,现在。
->更新概率分布(即数据点加权函数):
D_{t+1}(i) = [D_t(i) exp(-alpha_t y_i h_t(x_i))] / Z_t
同样,我们希望 "hard" 个样本的权重更大。那么,看看这个表达式的形式。我们正在更新 x_i
的概率质量。这取决于
D_t(i)
:x_i
的前次概率值(如果以前很重要,现在应该也很重要)alpha_y
:弱学习器的权重函数(更高权重的学习器意味着这个x_i
的概率质量变化会更强)y_i h_t(x_i)
:注意如果学习者错了则y_i h_t(x_i)=-1
,否则y_i h_t(x_i)=1
。在前一种情况下,-alpha_t y_i h_t(x_i)
将为正(因此exp(-alpha_t y_i h_t(x_i))
会很大);在后者中,负数(所以exp(-alpha_t y_i h_t(x_i))
会很小)。因此,这意味着我们将在 错误 时增加实例的概率,并在 正确的 时降低实例的概率。这是有道理的:如果h_t
在x_i
上是正确的,那么h_{t+1}
不应该太在意它;它应该关注h_t
错误的情况,并努力弥补它!
-> 合并弱学习器
最终的学习者只是弱学习者的加权平均值(由 alpha_t 加权)。就是这样。让我知道这是否有意义。
//(天啊,我真希望有 Latex……)