Exemplo n.º 1
0
    return int(2 ** board.bestTile)

root = Tk()
window = GameWindow(root)

EPOCHS_PER_GAME             = 10
NEURONS_IN_HIDDEN_LAYERS    = [17,500,500,4]
LIST_OF_FUNCTIONS           = ["rectify","rectify","softmax"]
LEARNING_RATE               = 0.003
MOMENTUM_RATE               = 0.9

a = Ann(neuronsInHiddenLayers=NEURONS_IN_HIDDEN_LAYERS, listOfFunctions=LIST_OF_FUNCTIONS, learningRate=LEARNING_RATE, momentumRate=MOMENTUM_RATE, errorFunc=10)
for i in range (50):
    trX, trY = get_data.get_training_data('training/train_data_'+str(i+1))
    print "Training on data "+str(i+1)
    a.training(trX, trY,len(trX)-1,EPOCHS_PER_GAME)

random_res = []
#random_res = [128, 128, 256, 64, 256, 128, 64, 64, 32, 64, 128, 128, 128, 128, 128, 128, 64, 128, 64, 128, 128, 64, 64, 64, 64, 128, 128, 128, 64, 128, 128, 128, 128, 128, 128, 128, 32, 128, 256, 64, 64, 128, 64, 64, 64, 128, 128, 64, 128, 64]

for i in range(50):
    print "Random game: "+str(i+1)
    board = Board()
    window.update_view( board.generateState(board.grid) )
    solver = Solver(board, window, root)
    solver.startSolver("random")
    random_res.append(int(2**board.bestTile))


ann_res=[]