【问题标题】:softmax activation function interpretationsoftmax激活函数解释
【发布时间】:2018-06-27 06:38:00
【问题描述】:

我在 tensorflow 中有一个神经网络,它有三个隐藏层,输出层有两个神经元,它由一个热编码值表示(可能输出 0 或 1,因此 [1, 0] 和 [0, 1 ])。 输入层由 60 个神经元组成,隐藏层内的激活是 reLU,我使用学习率为 0.001 的 AdamOptimizer。 我在尝试计算网络模型的结果时遇到问题:

prediction - 代表网络输出的变量

prediction_run = sess.run(prediction, feed_dict={x: mydata.reshape(1, 60)})
print("Original class: ", [1, 0], "Predicted values: ", prediction_run)

这将输出: 原始类:[1. 0.] 预测值:[[ 1.00000000e+00 3.35827508e-08]]

由于 Im using the softmax in the final layer, isn't this supposed to be an output that will sum up to 1? Like a probability or something. Im 无法理解这些预测数字,因为 softmax 应该转换它们,但事实并非如此。

self.tf.nn.softmax(self.tf.matmul(last_hidden_layer_activation, `output_layer_weights) + output_layer_biases)

有什么想法吗?

【问题讨论】:

标签: tensorflow neural-network softmax


【解决方案1】:

你是对的。 Softmax 输出的总和应该为 1。

问题在于浮点数。在浮点数的情况下,没有绝对零这样的东西。浮点数总是存在一些不确定性。更多信息here

【讨论】:

    猜你喜欢
    • 2021-03-23
    • 2021-03-06
    • 1970-01-01
    • 1970-01-01
    • 2021-03-19
    • 2012-04-11
    • 2016-10-13
    • 2020-09-14
    • 2018-03-24
    相关资源
    最近更新 更多