예제 #1
0
 def generate_nn_input(flat_board, color):
     encoded_boards = utils.encode_board(flat_board, color)
     player_liberties = utils.get_liberties(flat_board, color)
     opponent_liberties = utils.get_liberties(flat_board, -color)
     # print(encoded_boards.shape)
     # print(player_liberties.shape)
     # print(opponent_liberties.shape)
     X = np.concatenate(
         (encoded_boards, player_liberties, opponent_liberties), axis=1)
     return X
예제 #2
0
    def handle_data(self, data):
        boards = data[data.columns[3:-2]].as_matrix()

        y = utils.value_output(data['result'], data['color'])

        # Get symmetries and duplicate others accordingly
        X, _other = self.get_symmetries(boards, other_data=[y, data['color']])
        y, colors = _other[0], _other[1]
        X = utils.encode_board(X, colors)

        print('X.shape:', X.shape)
        print('Y.shape:', y.shape)

        return X, y
예제 #3
0
    def handle_data(self, data):
        boards = data[data.columns[3:-2]].as_matrix()

        y = utils.policy_output(data['move'])

        boards, _other = self.get_symmetries(boards,
                                             other_data=[y, data['color']])
        y, colors = _other

        X = utils.encode_board(boards, colors)

        print('X.shape:', X.shape)
        print('Y.shape:', y.shape)

        return X, y
예제 #4
0
    def handle_data(self, data):
        boards = data[data.columns[3:-2]].as_matrix()

        y = utils.policy_output(data['move'])

        boards, _other = self.get_symmetries(boards,
                                             other_data=[y, data['color']])
        y, colors = _other
        colors = colors.reshape(len(colors), 1)

        encoded_boards = utils.encode_board(boards, colors)
        player_liberties = utils.get_liberties_vectorized(boards, colors)
        opponent_liberties = utils.get_liberties_vectorized(boards, -colors)
        X = np.concatenate(
            (encoded_boards, player_liberties, opponent_liberties), axis=1)

        # print(X[-1])
        print('X.shape:', X.shape)
        print('Y.shape:', y.shape)

        return X, y
예제 #5
0
 def generate_nn_input(flat_board, color):
     X = utils.encode_board(flat_board, color)
     return X