Tensorflow-Tutorial icon indicating copy to clipboard operation
Tensorflow-Tutorial copied to clipboard

another way to compute accuray on 402_RNN_classification.py

Open leikunx opened this issue 7 years ago • 1 comments

I get high accuracy score on this way : isCorrect = tf.equal(tf.argmax(predict_Y, 1), tf.argmax(Y_holder, 1)) accuracy = tf.reduce_mean(tf.cast(isCorrect, tf.float32)) your code: accuracy = tf.metrics.accuracy( # return (acc, update_op), and create 2 local variables labels=tf.argmax(tf_y, axis=1), predictions=tf.argmax(output, axis=1),)[1] I think 2 way is same, but get different result, can you tell me the reason?

leikunx avatar Sep 29 '18 03:09 leikunx

Can you fix the random seed and test the result again?

Fix random seed by set:

tf.set_random_seed(1)
np.random.seed(1)

MorvanZhou avatar Sep 29 '18 08:09 MorvanZhou