diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2022-07-01 15:40:57 +0200 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2022-07-01 15:40:57 +0200 |
commit | 4cc55348c8dbb1902a1246fba66237d5c59f0349 (patch) | |
tree | ebc363dec6ae00f711be7ebd6e31530f25af1d9f /train.py | |
parent | 6724aeb3ba98c1b9f042344734c2d683e79dfc64 (diff) | |
download | imago-4cc55348c8dbb1902a1246fba66237d5c59f0349.tar.gz imago-4cc55348c8dbb1902a1246fba66237d5c59f0349.zip |
Finished writing documentation.
Diffstat (limited to 'train.py')
-rwxr-xr-x | train.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/train.py b/train.py new file mode 100755 index 0000000..0f518d0 --- /dev/null +++ b/train.py @@ -0,0 +1,27 @@ +#!/usr/bin/python + +"""Starts training a keras neural network.""" + +import sys + +from imago.sgfParser.sgf import loadGameTree +from imago.engine.keras.denseNeuralNetwork import DenseNeuralNetwork +from imago.engine.keras.convNeuralNetwork import ConvNeuralNetwork + +def main(): + games = [] + for file in sys.argv[1:]: + print(file) + games.append(loadGameTree(file)) + + matches = [game.getMainLineOfPlay() for game in games] + + modelFile = "" + boardsize = 9 + nn = DenseNeuralNetwork(modelFile, boardsize) + #nn = ConvNeuralNetwork(modelFile, boardsize) + nn.trainModel(matches) + nn.saveModel() + +if __name__ == '__main__': + main() |