What dimension to give to a neural network intputs?

3 days ago

I want to learn a policy network for a Domineering game

For each position I have to recall the input (i.e. the board, the flipped board,

and the turn) and the output of the same size as the board with only

the best move found by the Monte Carlo evaluation marked as 1.

For instance csv lines for a 2x2 board :


which corresponds to board, flipped board, player plane, move to learn

Corresponding input tensor :

0 0 1 1 1 1

0 0 1 1 1 1

Corresponding output tensor :

1 0

0 0

From here I have a 8*8 board games database. With this tutorial I already developed a failing neural network. Indeed I did 12 nodes for 128 inputs there seems to be a problem with the first layer model.add(Dense(12, input_dim=128, activation='relu')).

# model construction

model = Sequential()

model.add(Dense(12, input_dim=128, activation='relu'))

model.add(Dense(128, activation='relu'))

model.add(Dense(128, activation='sigmoid'))



  • Python indexes start with 0 and do not take the last element of the range. So the indexes 129:256 have only 127 elements. You should start with zero. Then 0:128 has 128 elements and 128:256 has 128 elements.

    The technical word for this is slice indexing.

    3 days ago