Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

another way to compute accuray on 402_RNN_classification.py #16

Open
leikunx opened this issue Sep 29, 2018 · 1 comment
Open

another way to compute accuray on 402_RNN_classification.py #16

leikunx opened this issue Sep 29, 2018 · 1 comment

Comments

@leikunx
Copy link

leikunx commented Sep 29, 2018

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?

@MorvanZhou
Copy link
Owner

MorvanZhou commented Sep 29, 2018

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants