TensorFlow的四种交叉熵

一种信息化的描述方法,用来定义信息中不确定因素的多少。机器学习结果的好坏评判标准就是两类信息之间的熵最小,由此引发了评判结果好坏的标准。

交叉熵

交叉熵(Cross Entropy)是Loss函数的一种(也称为损失函数或代价函数),用于描述模型预测值与真实值的差距大小,常见的Loss函数就是均方平方差(Mean Squared Error),定义如下。

![][matrix]
[matrix]: http://latex.codecogs.com/png.latex?C=\frac{(y-a)^2}{2}
​平方差表示预测值与真实值直接相减,为了避免得到负数取绝对值或者平方,再做平均就是均方平方差。注意这里预测值需要经过sigmoid激活函数,得到取值范围在0到1之间的预测值。
平方差可以表达预测值与真实值的差异,但在分类问题种效果并不如交叉熵好,原因可以参考这篇博文 。
交叉熵的定义如下,
当神经元函数为![][fact]这里
[fact]: http://latex.codecogs.com/png.latex?a=\sigma(z)

01: ![][01]
02: ![][02]
03: ![][03]
04: ![][04]
05: ![][05]
06: ![][06]
07: ![][07]
[00]: http://latex.codecogs.com/png.latex?\begin{bmatrix}1&x&x2\1&y&y2\1&z&z^2\\end{bmatrix}
[01]: http://latex.codecogs.com/png.latex?sh(x)=\frac{ex+e{-x}}{2}}
[02]: http://latex.codecogs.com/png.latex?C_n^k=\frac{n(n-1)\ldots(n-k+1)}{k!}
[03]: http://latex.codecogs.com/svg.latex?\begin{align}\sqrt{37}&=\sqrt{\frac{732-1}{122}}\&=\sqrt{\frac{732}{122}\cdot\frac{732-1}{732}}\&=\sqrt{\frac{732}{122}}\sqrt{\frac{732-1}{732}}\&=\frac{73}{12}\sqrt{1-\frac{1}{732}}\&\approx\frac{73}{12}\left(1-\frac{1}{2\cdot732}\right)\end{align}
[04]: http://latex.codecogs.com/svg.latex?\begin{array}{c|lcr}n&\text{Left}&\text{Center}&\text{Right}\\hline1&0.24&1&125\2&-1&189&-8\3&-20&2000&1+10i\\end{array}
[05]: http://latex.codecogs.com/svg.latex?\mathbb{N,Z,Q,R,C}
[06]: http://latex.codecogs.com/svg.latex?\left{\begin{array}{ll}a_1x+b_1y+c_1z&=d_1+e_1\a_2x+b_2y&=d_2\a_3x+b_3y+c_3z&=d_3\end{array}\right.
[07]: http://latex.codecogs.com/svg.latex?f\left(\left[\frac{1+\left{x,y\right}}{\left(\frac{x}{y}+\frac{y}{x}\right)\left(u+1\right)}+a\right]^{3/2}\right)

你可能感兴趣的:(TensorFlow的四种交叉熵)