blob: 3b0b3f544a856df251eb022438da03d46237c0ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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()
|