Skip to content

Commit 751661a

Browse files
committed
added accuracy to lab-07-2
1 parent b88d131 commit 751661a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lab-07-2-learning_rate_and_evaluation.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,10 @@
5353
plt.imshow(mnist.test.images[r:r + 1].reshape(28,
5454
28), cmap='Greys', interpolation='nearest')
5555
plt.show()
56+
57+
# Test model
58+
correct_prediction = tf.equal(tf.argmax(hypothesis, 1), tf.argmax(Y, 1))
59+
# Calculate accuracy
60+
accuracy = tf.reduce_mean(tf.cast(correct_prediction, "float"))
61+
print("Accuracy: ", accuracy.eval(session=sess, feed_dict={
62+
X: mnist.test.images, Y: mnist.test.labels}))

0 commit comments

Comments
 (0)