tensorflow常用函数之tf.nn.softmax

关于softmax的详细说明,请看Softmax。 
通过Softmax回归,将logistic的预测二分类的概率的问题推广到了n分类的概率的问题。通过公式 
 
可以看出当月分类的个数变为2时,Softmax回归又退化为logistic回归问题。

下面的几行代码说明一下用法

import tensorflow as tf
A = [1.0,2.0,3.0,4.0,5.0,6.0]
with tf.Session() as sess:
        print sess.run(tf.nn.softmax(A))

结果

[ 0.00426978  0.01160646  0.03154963  0.08576079  0.23312201  0.63369131]

 

转自TensorF学习网 :https://my.oschina.net/u/780234/blog/1588827

猜你喜欢

转载自blog.csdn.net/qq_38228254/article/details/83445894