深度学习笔记(四) cost function来源和证明

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,Yf(X)Y=f(X)

平方损失函数(quadratic loss function)

L(Y,f(X))=(Yf(X))2

绝对损失函数(absolute loss function)

L(Y,f(X))=|Yf(X)|

对数损失函数(logarithmic loss function) 或对数似然损失函数(log-likelihood loss function)

L(Y,P(Y|X))=logP(Y|X)

4)代价函数使用场景

a)线性回归  均方损失
\begin{align}J(\theta) = -\frac{1}{m} \left[ \sum_{i=1}^m y^{(i)} \log h_\theta(x^{(i)}) + (1-y^{(i)}) \log (1-h_\theta(x^{(i)})) \right]\end{align}

b)逻辑回归/sigmoid函数 采用如下交叉熵损失

\begin{align}J(\theta) = - \frac{1}{m} \left[ \sum_{i=1}^{m} \sum_{j=1}^{k} 1\left\{y^{(i)} = j\right\} \log \frac{e^{\theta_j^T x^{(i)}}}{\sum_{l=1}^k e^{ \theta_l^T x^{(i)} }}\right]\end{align}
c)softmax回归



5)证明代价函数来源:
都是采用最大似然估计选取Cost Function
证明参考:L(&) 为似然估计:
线性方程的:

sigmoid的:


 具体参考:
参考: http://www.mamicode.com/info-detail-642956.html

转载请说明来源:http://blog.youkuaiyun.com/chenfenggang/article/details/77587656







评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值