Add.Support vector machines

pull/2/head
benjas 4 years ago
parent 62150e9389
commit 11d182272a

@ -139,13 +139,8 @@ Support vector machines
> 图中心,虚线到实线的距离我们称之为γ,我们要做的是最大化γ,使得这个超平面调整为γ的一个最大值,等价于找到了最优的超平面
**式子如下:**
$$
\max_{w,b} \quad γ
$$
$$
s.t.\quad y_i(\frac{w}{||w||}*x_i+\frac{b}{||w||})≥γ \quad i=1,2,...,N
$$
![1620100488418](assets/1620100488418.png)
> γ:表示几何间隔
>
@ -164,47 +159,68 @@ $$
既然我们最终是\frac{\hat{γ}}{||w||} ,那么式子我们可以简化成
$$
$$
y_i(wx_i+b)≥\hat{γ},其中\hat{γ}是函数间隔
$$
![1620100528671](assets/1620100528671.png)
max的时候是几何间隔也就是最终s.t. 还是会约束着它朝着几何间隔去走,但是这样的好处就是下方的||w||就没有了
**简化后如下:**
$$
\max_{w,b} \quad \frac{\hat{γ}}{||w||}
$$
$$
s.t.\quad y_i(w*x_i+b)≥γ \quad i=1,2,...,N
$$
![1620100544902](assets/1620100544902.png)
之前我们说过对于函数间隔我们等比例放大缩小w、b可以让最终结果变成1也就是γ=1
**再简化后:**
![1620100565725](assets/1620100565725.png)
$$
\max_{w,b} \quad \frac{1}{||w||}
后面要用到拉格朗日乘子法,我们把\frac{1}{||w||}变成\frac{1}{2}||w||^2这两者是等价的
$$
**再简化后:**
![1620100585894](assets/1620100585894.png)
$$
s.t.\quad y_i(w*x_i+b)≥1 \quad i=1,2,...,N
\min_{w,b} \quad \frac{1}{2}||w||^2
$$
$$
我们想要最大化\frac{1}{||w||},那么相当于最小化||w||
s.t.\quad y_i(w*x_i+b)-1≥0 \quad i=1,2,...,N
$$
> 利用拉格朗日乘子法,推导成如下式子
![1620100681735](assets/1620100681735.png)
$$
后面要用到拉格朗日乘子法,我们把\frac{1}{||w||}变成\frac{1}{2}||w||^2这两者是等价的
L(w,b,α)=\quad \frac{1}{2}||w||^2-\sum^N_{i=1}α_iy_i(w*x_i+b)+\sum^N_{i=1}α_i
$$
**再简化后:**
$$
\min_{w,b} \quad \frac{1}{2}||w||^2
目标:\min_{w,b}\max_aL(w,b,α)
$$
$$
s.t.\quad y_i(w*x_i+b)-1≥0 \quad i=1,2,...,N
转换成:\max_a\min_{w,b}L(w,b,α)
$$
将拉格朗日函数L(w,b,α)分别对w,b求偏导并令其等于0
![1620100449792](assets/1620100449792.png)
进行推导
![1620100641814](assets/1620100641814.png)
2.求minL(w,b,α)对α的极大,即是对偶问题
![1620100936402](assets/1620100936402.png)
3.求max转换成min
![1620101031289](assets/1620101031289.png)
接下来就是求解α的问题了

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Loading…
Cancel
Save