损失函数
1 Square loss
![](https://images2015.cnblogs.com/blog/808203/201609/808203-20160913183225648-2104209459.png)
2 Hinge loss
3 Logistic loss
4 Cross entropy loss
Using the alternative label convention
,so that
,
![](https://images2015.cnblogs.com/blog/808203/201609/808203-20160913183227523-1083489425.png)
![](https://images2015.cnblogs.com/blog/808203/201609/808203-20160913183227836-138698776.png)
the cross entropy loss is defined as
x = np.linspace(-3, 3, 1000)
y_logit = np.log(1 + np.exp(-x)) / math.log(2)
y_01 = x < 0
y_hinge = 1 - x
y_hinge[y_hinge < 0] = 0