TensorFlow使用说明及接口函数

tf.nn.softmax

2018-02-10  本文已影响39人  dopami

关于softmax的详细说明,请看Softmax

通过Softmax回归,将logistic的预测二分类的概率的问题推广到了n分类的概率的问题。通过公式

可以看出当月分类的个数变为2时,Softmax回归又退化为logistic回归问题。

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

# -*- coding: utf-8 -*-

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]

上一篇 下一篇

猜你喜欢

热点阅读