1)什么是代价函数
WIKI的解释:
Cost function
- In economics, the cost curve, expressing production costs in terms of the amount produced.
- In mathematical optimization, the loss function, a function to be minimized.
- In artificial neural networks, the function to return a number representing how well the neural network performed to map training examples to correct output.
2)为啥需要代价函数。
学自动化的时候,我们要求系统是收敛的,稳定的。对于模型,输入x,产生的输出y,希望能最接近期望的Y,如果y不能等于Y时,我们希望知道模型离期望的Y有多远,所以
我们需要定义一个cost function以衡量模型的好坏。通过cost function反过来可以调整模型的参数。
3)代价函数有哪些
0-1损失函数(0-1 loss function):
L(Y,f(X))={1,0,Y≠f(X)Y=f(X)
平方损失函数(quadratic loss function)
L(Y,f(X))=(Y−f(X))2
绝对损失函数(absolute loss function)
L(Y,f(X))=|Y−f(X)|
对数损失函数(logarithmic loss function) 或对数似然损失函数(log-likelihood loss function)
L(Y,P(Y|X))=−logP(Y|X)
4)代价函数使用场景
a)线性回归
均方损失
b)逻辑回归/sigmoid函数 采用如下交叉熵损失
c)softmax回归
5)证明代价函数来源:
都是采用最大似然估计选取Cost Function
证明参考:L(&) 为似然估计:
线性方程的:
sigmoid的:
具体参考:
参考: http://www.mamicode.com/info-detail-642956.html
转载请说明来源:http://blog.youkuaiyun.com/chenfenggang/article/details/77587656