Skip to content

Commit

Permalink
easily make accuracy draw near 50% via reduplicate train
Browse files Browse the repository at this point in the history
  • Loading branch information
zddhub committed Apr 27, 2017
1 parent 6dc70d0 commit 9afbdf5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions input_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def one_hot(self, label):
r[self.types.index(label)] = 1
return r

def rewind(self):
self.train_i = 0
self.test_i = 0

def train_next_batch(self, size):
if self.train_i > len(self.train_indexes):
return None, None
Expand Down
9 changes: 6 additions & 3 deletions trytf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ def main(_):
tf.global_variables_initializer().run()

# Train
for _ in range(180):
batch_xs, batch_ys = input_data.train_next_batch(100)
sess.run(train_step, feed_dict={x: batch_xs, y_: batch_ys})
for _ in range(20):
for _ in range(90):
batch_xs, batch_ys = input_data.train_next_batch(200)
sess.run(train_step, feed_dict={x: batch_xs, y_: batch_ys})

input_data.rewind()

# Test trained model
correct_prediction = tf.equal(tf.argmax(y, 1), tf.argmax(y_, 1))
Expand Down

0 comments on commit 9afbdf5

Please sign in to comment.