Skip to content

Commit 5f2f8ec

Browse files
committedNov 29, 2017
Added convolutional net results
1 parent d0cff2c commit 5f2f8ec

File tree

2 files changed

+110
-7
lines changed

2 files changed

+110
-7
lines changed
 

‎src/csv/convolutional.csv

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
epoch,test_accuracy
2+
0,0.0934
3+
1,0.9623
4+
2,0.9759
5+
3,0.9807
6+
4,0.9834
7+
5,0.9867
8+
6,0.9861
9+
7,0.9881
10+
8,0.9887
11+
9,0.9899
12+
10,0.9891
13+
11,0.991
14+
12,0.9913
15+
13,0.9889
16+
14,0.992
17+
15,0.9925
18+
16,0.9909
19+
17,0.9919
20+
18,0.9918
21+
19,0.9922
22+
20,0.9923
23+
21,0.9924
24+
22,0.9923
25+
23,0.9918
26+
24,0.9917
27+
25,0.9904
28+
26,0.9921
29+
27,0.9928
30+
28,0.9911
31+
29,0.993
32+
30,0.9927
33+
31,0.992
34+
32,0.9916
35+
33,0.9926
36+
34,0.992
37+
35,0.9917
38+
36,0.9935
39+
37,0.9927
40+
38,0.9924
41+
39,0.9925
42+
40,0.9923
43+
41,0.9925
44+
42,0.9925
45+
43,0.9923
46+
44,0.992
47+
45,0.9924
48+
46,0.9923
49+
47,0.9928
50+
48,0.9935
51+
49,0.993
52+
50,0.9934
53+
51,0.9931
54+
52,0.9925
55+
53,0.9929
56+
54,0.9933
57+
55,0.9929
58+
56,0.9929
59+
57,0.9936
60+
58,0.9934
61+
59,0.9929
62+
60,0.9926
63+
61,0.9935
64+
62,0.9929
65+
63,0.9934
66+
64,0.9939
67+
65,0.9935
68+
66,0.993
69+
67,0.9931
70+
68,0.9928
71+
69,0.9925
72+
70,0.9929
73+
71,0.9937
74+
72,0.993
75+
73,0.9932
76+
74,0.994
77+
75,0.9933
78+
76,0.9928
79+
77,0.9924
80+
78,0.9928
81+
79,0.9919
82+
80,0.9931
83+
81,0.9932
84+
82,0.993
85+
83,0.9932
86+
84,0.9934
87+
85,0.9926
88+
86,0.9927
89+
87,0.9934
90+
88,0.9924
91+
89,0.9934
92+
90,0.9934
93+
91,0.9936
94+
92,0.9933
95+
93,0.9932
96+
94,0.9935
97+
95,0.9934
98+
96,0.9933
99+
97,0.9931
100+
98,0.993
101+
99,0.993

‎src/mnist_convolutional.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import division
2+
13
import numpy as np
24
import tensorflow as tf
35

@@ -60,18 +62,18 @@ def main():
6062
correct_prediction = tf.equal(tf.argmax(y_conv, 1), tf.argmax(y_, 1))
6163
accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
6264

65+
num_examples = mnist.train.images.shape[0]
66+
6367
with tf.Session() as sess:
6468
sess.run(tf.global_variables_initializer())
65-
for i in range(20000):
69+
print('epoch,test_accuracy')
70+
for i in range(100 * (num_examples // 100)):
71+
if i % (num_examples // 100) == 0:
72+
test_accuracy = accuracy.eval(feed_dict={x: mnist.test.images, y_: mnist.test.labels, keep_prob: 1.0})
73+
print('%d,%g' % (i // (num_examples // 100), test_accuracy))
6674
batch = mnist.train.next_batch(100)
67-
if i % 100 == 0:
68-
train_accuracy = accuracy.eval(feed_dict={x: batch[0], y_: batch[1], keep_prob: 1.0})
69-
print('step %d, training accuracy: %g' % (i, train_accuracy))
7075
train_step.run(feed_dict={x: batch[0], y_: batch[1], keep_prob: 0.5})
7176

72-
print('test accuracy %g' %
73-
accuracy.eval(feed_dict={x: mnist.test.images, y_: mnist.test.labels, keep_prob: 1.0}))
74-
7577

7678
if __name__ == '__main__':
7779
main()

0 commit comments

Comments
 (0)
Please sign in to comment.