@@ -191,11 +191,11 @@ def model(x):
191
191
print 'Done training the model!'
192
192
193
193
# validating the model
194
- J_train = sess .run (cost , feed_dict = {x : X_train , y : Y_train })
194
+ # J_train = sess.run(cost, feed_dict={x: X_train, y: Y_train})
195
195
# J_validate = sess.run(cost, feed_dict={x: X_validate, y: Y_validate})
196
196
# J_test = sess.run(cost, feed_dict={x: X_test, y: Y_test})
197
197
198
- print 'Final cost over training set: ' , J_train
198
+ # print 'Final cost over training set: ', J_train
199
199
# print 'Final cost over validation set: ', J_validate
200
200
# print 'Final cost over test set: ', J_test
201
201
@@ -204,13 +204,17 @@ def model(x):
204
204
accuracy = tf .reduce_mean (tf .cast (corr_pred , tf .float32 ))
205
205
206
206
print '\n Predicting accuracy...'
207
- print 'Training accuracy: ' , sess .run (accuracy , feed_dict = {x : X_train , y : Y_train }) * 100 , ' %'
207
+ acc = []
208
+ for idx in range (10 ):
209
+ acc .append (sess .run (accuracy , feed_dict = {x : X_train [idx * 6000 :(idx + 1 )6000 ], y : Y_train [idx * 6000 :(idx + 1 )6000 ]}))
210
+ print 'Training accuracy: ' , (sum (acc )/ 10.0 ) * 100 , ' %'
208
211
# print 'Validation accuracy: ', sess.run(accuracy, feed_dict={x: X_validate, y: Y_validate}) * 100
209
212
# print 'Test accuracy: ', sess.run(accuracy, feed_dict={x: X_test, y: Y_test}) * 100
210
213
211
214
# save the weights and costs
212
215
np .savez ('./weights.npz' , wc1 = sess .run (wc1 ), wc2 = sess .run (wc2 ), wf1 = sess .run (wf1 ), wo = sess .run (wo ))
213
216
np .savez ('./bias.npz' , bc1 = sess .run (bc1 ), bc2 = sess .run (bc2 ), bf1 = sess .run (bf1 ), bo = sess .run (bo ))
214
217
np .savez ('./cost.npz' , epoch_cost = cost_vec_epoch , batch_cost = cost_vec_batch )
218
+ np .savez ('./accuracy.npz' , acc = acc )
215
219
216
220
print '\n Total time taken: ' , time .time () - init_time
0 commit comments