hinge loss:
Given an example
(xi,yi)
(
x
i
,
y
i
)
, where the
xi
x
i
is the image and where
yi
y
i
is the integer label.
and using the shorthand for the scores vector:
s=f(xi,W)
s
=
f
(
x
i
,
W
)
the SVM loss has the form:
Li=∑ j!=yimax(0,Sj−Syi+1)
L
i
=
∑
j
!
=
y
i
m
a
x
(
0
,
S
j
−
S
y
i
+
1
)
,其中
Syi
S
y
i
代表正确分类的预测值
也就是说损失函数的定义,是想要正确分类的分数远比其他类别的分数高。
正则化:
L1 正则化:
J(θ)=[yθ(x)−y]2+[|θ1|+|θ2|+...]
J
(
θ
)
=
[
y
θ
(
x
)
−
y
]
2
+
[
|
θ
1
|
+
|
θ
2
|
+
.
.
.
]
L2 正则化:
J(θ)=[yθ(x)−y]2+[θ21+θ22+...]
J
(
θ
)
=
[
y
θ
(
x
)
−
y
]
2
+
[
θ
1
2
+
θ
2
2
+
.
.
.
]
西瓜书252-253页有介绍,L1范数有利于得到稀疏解,求到的权值会有更少的非零分量。
softmax loss:
多项逻辑回归损失