如何将 logits 转换为 tensorflow 中二元分类的概率? [英] how to convert logits to probability in binary classification in tensorflow?

查看:17
本文介绍了如何将 logits 转换为 tensorflow 中二元分类的概率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

logits= tf.matmul(inputs, weight) + bias

经过 matmul 运算后,logits 是两个源自 MLP 层的值.我的目标是二元分类,如何将 logits 两个值转换为概率,其中包括正概率和负概率,并且它们的总和为 1?

After matmul operation, the logits are two values derive from the MLP layer. My target is binary classification, how to convert the two values, logits, into probabilities, which include positive prob and negative prob and the sum of them is 1 ?

推荐答案

predictions = tf.nn.softmax(logits)

这篇关于如何将 logits 转换为 tensorflow 中二元分类的概率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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