aboutsummaryrefslogtreecommitdiff
path: root/testKeras.py
diff options
context:
space:
mode:
Diffstat (limited to 'testKeras.py')
-rwxr-xr-xtestKeras.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/testKeras.py b/testKeras.py
new file mode 100755
index 0000000..3b0b3f5
--- /dev/null
+++ b/testKeras.py
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+
+"""Starts training a keras neural network."""
+
+import sys
+
+from imago.sgfParser.sgf import loadGameTree
+from imago.engine.keras.neuralNetwork import NeuralNetwork
+
+def main():
+ games = []
+ for file in sys.argv[1:]:
+ print(file)
+ games.append(loadGameTree(file))
+
+ matches = [game.getMainLineOfPlay() for game in games]
+
+ modelFile = "models/testModel.h5"
+ nn = NeuralNetwork(modelFile, 9)
+ nn.trainModel(matches)
+ nn.saveModel()
+
+if __name__ == '__main__':
+ main()