diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2016-02-09 10:24:02 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2016-02-09 10:24:02 +0100 |
| commit | cc85180adec2569727652a61b9024ffcb5937fdd (patch) | |
| tree | 44bb1dda92c7c5075ce480150d85409993116e59 | |
| parent | 641daf06c0bbf98ebec16b29f0b3575b083d434e (diff) | |
| download | boston-neuralnet-cc85180adec2569727652a61b9024ffcb5937fdd.tar.gz boston-neuralnet-cc85180adec2569727652a61b9024ffcb5937fdd.zip | |
vor rewrite
| -rw-r--r-- | boston.py | 27 |
1 files changed, 20 insertions, 7 deletions
@@ -57,8 +57,8 @@ with tf.device('/cpu:0'): # all variables have to be specified here sess.run(tf.initialize_all_variables()) - mse = tf.Print(mse, [mse], "mse: ") - train_step = tf.train.GradientDescentOptimizer(0.0001).minimize(mse) + # mse = tf.Print(mse, [mse], "mse: ") + train_step = tf.train.GradientDescentOptimizer(0.01).minimize(mse) last = 0 @@ -68,6 +68,7 @@ next_last = last + batchsize factor = [[max(target) - min(target)]] offset = [[min(target)]] +batchcount = 0 # TODO rethink this while next_last < len(x_train): print("running next batch") @@ -79,16 +80,28 @@ while next_last < len(x_train): xt = x_train[last:next_last] yt = [y_train[last:next_last]] - for i in range(0, 100): # 100 epochs - if i % 100 == 0: - feed = {input_matrix: x_test, real: [y_test], fact: factor, offs: offset} + trainsteps = 100 + for i in range(0, trainsteps): # 100 epochs + if i % 10 == 9: + feed = { + input_matrix: xt, # x_test, + real: yt, # [y_test], + fact: factor, + offs: offset + } result = sess.run([merged, mse, difference], feed_dict=feed) - writer.add_summary(result[0], i) + writer.add_summary(result[0], batchcount * trainsteps + i) sess.run(train_step, - feed_dict={input_matrix: xt, real: yt, fact: factor, offs: offset}) + feed_dict={ + input_matrix: xt, + real: yt, + fact: factor, + offs: offset + }) last = next_last + batchcount += 1 print("finished training") |
