Added a normalised version of quack
This commit is contained in:
parent
160f5bd737
commit
e5cc54d3e0
14
board.py
14
board.py
|
@ -54,6 +54,20 @@ class Board:
|
||||||
return np.array(board).reshape(1,-1)
|
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
|
# tesauro
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def board_features_tesauro(board, cur_player):
|
def board_features_tesauro(board, cur_player):
|
||||||
|
|
|
@ -17,7 +17,8 @@ class Network:
|
||||||
board_reps = {
|
board_reps = {
|
||||||
'quack-fat' : (30, Board.board_features_quack_fat),
|
'quack-fat' : (30, Board.board_features_quack_fat),
|
||||||
'quack' : (28, Board.board_features_quack),
|
'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):
|
def custom_tanh(self, x, name=None):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user