summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--neuralnet.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/neuralnet.py b/neuralnet.py
index 6434e8a..7956ea5 100644
--- a/neuralnet.py
+++ b/neuralnet.py
@@ -99,14 +99,16 @@ with tf.device('/cpu:0'):
# Alle Tensorflow-Variablen müssen bis hier spezifiziert sein!
sess.run(tf.initialize_all_variables())
- jsonLog = dict()
+ jsonWeights = dict()
+ jsonError = dict()
# Training
for count in range(0, int(len(x_train) / BATCH)):
- jsonLog[count] = dict()
+ jsonWeights[count] = dict()
print("batch " + str(count))
for i in range(0, STEPS):
result = sess.run([summaries,
vecBias, matWeights, matWeightsHidden,
+ scalarError,
train_step],
feed_dict={
matInput: x_train[count*BATCH:(count+1)*BATCH],
@@ -116,10 +118,15 @@ with tf.device('/cpu:0'):
if not os.path.exists("inspect"):
os.makedirs("inspect")
- jsonLog[count][i] =\
+ jsonWeights[count][i] =\
[[result[1].tolist()]] + [a.tolist() for a in result[2:4]]
- f = open("inspect/log.json", "w+")
- json.dump(jsonLog, f)
+ jsonError[count*BATCH+i] = str(result[4])
+ f = open("inspect/weights.json", "w+")
+ json.dump(jsonWeights, f)
+ f.close()
+ print(jsonError)
+ f = open("inspect/error.json", "w+")
+ json.dump(jsonError, f)
f.close()
print("Training beendet")