Added a normalised version of quack

This commit is contained in:
Alexander Munch-Hansen 2018-04-23 00:35:25 +02:00
parent 160f5bd737
commit e5cc54d3e0
2 changed files with 16 additions and 1 deletions

View File

@ -54,6 +54,20 @@ class Board:
return np.array(board).reshape(1,-1)
# quack-fatter
@staticmethod
def board_features_quack_norm(board, player):
board = list(board)
positives = [x if x > 0 else 0 for x in board]
negatives = [x if x < 0 else 0 for x in board]
board[0] = board[0] / 2
board[25] = board[25] / 2
board = [board[x] / 15 for x in range(1,25)]
board.append(15 - sum(positives))
board.append(-15 - sum(negatives))
board += ([1, 0] if np.sign(player) > 0 else [0, 1])
return np.array(board).reshape(1, -1)
# tesauro
@staticmethod
def board_features_tesauro(board, cur_player):

View File

@ -17,7 +17,8 @@ class Network:
board_reps = {
'quack-fat' : (30, Board.board_features_quack_fat),
'quack' : (28, Board.board_features_quack),
'tesauro' : (198, Board.board_features_tesauro)
'tesauro' : (198, Board.board_features_tesauro),
'quack-norm': (30, Board.board_features_quack_norm)
}
def custom_tanh(self, x, name=None):