交叉熵是否非负?
来源:互联网 发布:淘宝怎么设置客服接待 编辑:程序博客网 时间:2024/05/17 01:57
在Ian Goodfellow那本Deep Learning Book中有这样一段描述:
One unusual property of the cross-entropy cost used to perform maximum likelihood estimation is that it usually does not have a minimum value when applied to the models commonly used in practice. For discrete output variables, most models are parametrized in such a way that they cannot represent a probability of zero or one, but can come arbitrarily close to doing so. Logistic regression is an example of such a model. For real-valued output variables, if the model can control the density of the output distribution (for example, by learning the variance parameter of a Gaussian output distribution) then it becomes possible to assign extremely high density to the correct training set outputs, resulting in cross-entropy approaching negative infinity.
http://www.deeplearningbook.org/contents/mlp.html p.175
第一次看的时候很是迷惑,好像从来没有见过负的交叉熵啊。我们知道交叉熵可以写成熵和KL散度之和:
其中
中间的大于等于号来自于詹森不等式。
对于H(p), 隐约记得熵应该也是非负的:
p是概率,必定在[0, 1],
这样讲,交叉熵一定是非负了,怎么可能有negative infinity呢?
再仔细读一遍上面出现negative infinity的那句话。
For real-valued output variables, if the model can control the density of the output distribution (for example, by learning the variance parameter of a Gaussian output distribution) then it becomes possible to assign extremely high density to the correct training set outputs, resulting in cross-entropy approaching negative infinity.
原来重点在real-valued output variables. 对于连续随机变量来说,熵的定义要写成积分形式:
这里的p就变成了概率密度,取值范围变成了
因此对于,连续随机变量,熵有可能是负的。
我们再看,交叉熵的定义:
我们同样假定q(x)是个Dirac delta function,那么这个交叉熵也就变成了负无穷。
这也是上面那段话后半段的应有之义。
it becomes possible to assign extremely high density to the correct training set outputs, resulting in cross-entropy approaching negative infinity.
因此,我们的结论是:
- 对于离散随机变量,交叉熵是非负的。如果你的分类问题是softmax + cross_entropy_loss 出现了负的loss,那肯定是算错了。
- 对于连续随机变量,交叉熵有可能是负。
- 交叉熵是否非负?
- havel 定理 判断非负序列 是否可以图化
- php验证是否为非零整数(正整数、负整数)
- 非负矩阵因式分解
- 高精度非负整数
- 非负矩阵分解
- 非负矩阵分解
- 非负矩阵分解
- 判断输入的一个非负的正整数,其是否是2的幂
- 如何判断一个非负整数是否是2的幂
- Python 中对文本框内容是否为非负整数的检判别
- 快速判断一个非负整数是否为完全平方数
- 如何判断一个非负整数是否是2的幂
- 判断一个非负整数是否为2的n次幂?-by大彬
- 扩展欧几里德算法 x的最小非负整数解 xy是否有非负整数解
- NMF 非负矩阵分解
- 非负矩阵分解算法
- 分离非负整数--gyy
- “删除重复元素”:保留两个
- [队内测试Day10.22T1][bzoj1821]部落划分 Group
- JZ2440 第7章 内存管理单元 MMU
- 22.WebBrowser中JS和C++代码互相调用
- 从YOLOv1谈到YOLOv2(3)二代的准确度改进(上)
- 交叉熵是否非负?
- Android高效加载大图、多图解决方案,有效避免程序OOM 摘记
- [HDU] 5544 Ba Gua Zhen
- 网络学习——Unity3D的Time类(UnityEngine.Time)详解
- jsp九大内置对象,作用及方法
- Java多线程——线程间协作方式总结及使用示例
- 文章标题
- C++ 内联函数
- 关于数字编码的小知识