LoginSignup
1
1

More than 5 years have passed since last update.

TensorFlow > cross_entropyの定義 > tf.reduce_sum()の使い方の違い > インデックス1の総和の平均 / すべての総和

Last updated at Posted at 2016-10-09

http://blog.brainpad.co.jp/entry/2016/02/12/163100

https://www.tensorflow.org/versions/r0.11/tutorials/mnist/beginners/index.html
にてTensorFlowを勉強中。

braindPadさんのコードとtensorflow.orgのコードでreduce_sum()の使い方が若干違っている。

atBrainPad
# 誤差関数の交差エントロピー誤差関数を用意
cross_entropy = -tf.reduce_sum(y_*tf.log(y))
tensorflow.org
cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y), reduction_indices=[1]))

後者の方ではインデックス1で総和をとった値のリストから平均を取る。
前者の方ではすべての値の総和を取る。

この違いが結果にどう影響するかは未消化。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1