个人笔记,非教程
LSSVM和SVM的区别就在于,LSSVM把原方法的不等式约束变为等式约束,从而大大方便了Lagrange乘子alpha的求解,原问题是QP问题,而在LSSVM中则是一个解线性方程组的问题。
min
w
,
b
,
e
J
(
w
,
e
)
=
1
2
w
T
w
+
1
2
γ
∑
i
=
1
N
e
i
2
\min_{w,b,e}J(w,e)=\frac 12 w^Tw+\frac 12\gamma\sum_{i=1}^{N}e_i^2
w
,
b
,
e
min
J
(
w
,
e
)
=
2
1
w
T
w
+
2
1
γ
i
=
1
∑
N
e
i
2
s
.
t
.
y
i
(
w
T
x
i
+
b
)
=
1
−
e
i
,
i
=
1
,
.
.
.
,
N
s.t.\ \ \ \ y_i(w^Tx_i+b)=1-e_i,\ \ \ i=1,…,N
s
.
t
.
y
i
(
w
T
x
i
+
b
)
=
1
−
e
i
,
i
=
1
,
.
.
.
,
N
拉格朗日
L
(
w
,
b
,
e
;
α
)
=
J
(
w
,
e
)
−
∑
i
=
1
N
α
i
[
y
i
(
w
T
x
i
+
b
)
−
1
+
e
i
]
L(w,b,e;\alpha)=J(w,e)-\sum_{i=1}^{N}\alpha_i[y_i(w^Tx_i+b)-1+e_i]
L
(
w
,
b
,
e
;
α
)
=
J
(
w
,
e
)
−
i
=
1
∑
N
α
i
[
y
i
(
w
T
x
i
+
b
)
−
1
+
e
i
]
求导并令其为零
∂
L
∂
w
=
0
→
w
=
∑
i
=
1
N
α
i
y
i
x
i
∂
L
∂
b
=
0
→
0
=
∑
i
=
1
N
α
i
y
i
∂
L
∂
e
i
=
0
→
α
i
=
γ
e
k
,
k
=
1
,
.
.
.
,
N
∂
L
∂
a
i
=
0
→
y
i
(
w
T
x
i
+
b
)
−
1
+
e
k
=
0
,
k
=
1
,
.
.
.
,
N
\begin{aligned} \frac{\partial L}{\partial w}&=0\to w=\sum_{i=1}^{N}\alpha_iy_ix_i \\ \frac{\partial L}{\partial b}&=0\to 0=\sum_{i=1}^{N}\alpha_iy_i \\ \frac{\partial L}{\partial e_i}&=0\to \alpha_i=\gamma e_k, \ \ \ k=1,…,N \\ \frac{\partial L}{\partial a_i}&=0\to y_i(w^Tx_i+b)-1+e_k=0,\ \ \ k=1,…,N \end{aligned}
∂
w
∂
L
∂
b
∂
L
∂
e
i
∂
L
∂
a
i
∂
L
=
0
→
w
=
i
=
1
∑
N
α
i
y
i
x
i
=
0
→
0
=
i
=
1
∑
N
α
i
y
i
=
0
→
α
i
=
γ
e
k
,
k
=
1
,
.
.
.
,
N
=
0
→
y
i
(
w
T
x
i
+
b
)
−
1
+
e
k
=
0
,
k
=
1
,
.
.
.
,
N
转换为关于
α
\alpha
α
和
b
b
b
的线性方程组形式:
[
0
Y
T
Y
(
Y
Y
T
)
⨀
(
X
X
T
)
+
γ
−
1
I
]
[
b
α
]
=
[
0
1
]
\begin{bmatrix} 0 & Y^T \\ Y & (YY^T)\bigodot (XX^T)+\gamma^{-1}I \\ \end{bmatrix} \begin{bmatrix} b \\ \alpha \\ \end{bmatrix} = \begin{bmatrix} 0 \\ \bold 1 \\ \end{bmatrix}
[
0
Y
Y
T
(
Y
Y
T
)
⨀
(
X
X
T
)
+
γ
−
1
I
]
[
b
α
]
=
[
0
1
]
其中
⨀
\bigodot
⨀
规则为将矩阵对应位置的元素分别相乘,
1
\bold 1
1
为一列1构成的向量
上面的矩阵大概长这个样子:
(
Y
Y
T
)
⨀
(
X
T
X
)
+
γ
−
1
I
(YY^T)\bigodot (X^TX)+\gamma^{-1}I
(
Y
Y
T
)
⨀
(
X
T
X
)
+
γ
−
1
I
里的第
i
i
i
行第
j
j
j
列元素为
y
i
y
j
x
i
T
x
j
y_iy_jx_i^Tx_j
y
i
y
j
x
i
T
x
j