Tensorflow:S形交叉熵损失产生的输出概率 [英] Tensorflow: Output probabilities from sigmoid cross entropy loss

查看:78
本文介绍了Tensorflow:S形交叉熵损失产生的输出概率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于多标签分类问题的CNN,并且使用 tf.nn.sigmoid_cross_entropy_with_logits 作为损失函数.

I have a CNN for a multilabel classification problem and as a loss function I use the tf.nn.sigmoid_cross_entropy_with_logits .

交叉熵方程我希望输出是每个类的概率但相反,我在(-∞,∞)中出现了浮点数.

From the cross entropy equation I would expect that the output would be probabilities of each class but instead I get floats in the (-∞, ∞) .

经过一番谷歌搜索后,我发现由于进行了一些内部规范化操作,每行对数在被送入方程式之前都可以解释为概率.

After some googling I found that due to some internal normalizing operation each row of logits is interpretable as probability before being fed to the equation.

我很困惑如何实际输出后验概率而不是浮点数来绘制ROC.

I'm confused about how I can actually output the posterior probabilities instead of floats in order to draw a ROC.

推荐答案

tf.sigmoid(logits)为您提供了概率.

您可以在 tf.nn.sigmoid_cross_entropy_with_logits 是将logit归一化为概率的函数.

You can see in the documentation of tf.nn.sigmoid_cross_entropy_with_logits that tf.sigmoid is the function that normalizes the logits to probabilities.

这篇关于Tensorflow:S形交叉熵损失产生的输出概率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆