私はtensorflowデモを書くとき、私はテンソルの軸間の最大値でインデックスを返しますcorrect_predition
テンソルフローのsoftmaxでtf.arg_max(Y、1)が必要なのはなぜですか?
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(
logits=hypothesis,labels=Y))
optimizer = tf.train.AdamOptimizer(learning_rate=learning_rate).minimize(cost)
correct_prediction = tf.equal(tf.arg_max(hypothesis,1),tf.arg_max(Y,1))
の定義にこのarg_max()
機能を見つけます。は
我々は最大のインデックスを取得する確率として提示されている
我々は 'softmax_cross_entropy_with_logits
' を使用するために、
予測(hypothesis
)(これは、TFからAPIからです) arg_max()
hypothesis
しかしY
はラベルですなぜ使用する必要があるのでしょうかtf.arg_max(Y,1)
?
ありがとうございます。 *** Yは長さ10の1ホットベクトルです。***はこの質問にとって重要です。 –