6
I am beginner in dealing with Nns, and need help and explanation in certain things with my first project.
Basicamento, to making an NN for checkers, my input are the black parts of the board (8x4) filled with the state: 0 empty, 1 normal piece, 3 queen. Positive or negative symbolizes whether you are an ally or an enemy:
[[ 1. 1. 1. 1.]
[ 1. 1. 1. 1.]
[ 1. 1. 1. 1.]
[ 0. 0. 0. 0.]
[ 0. 0. 0. 0.]
[-1. -1. -1. -1.]
[-1. -1. -1. -1.]
[-1. -1. -1. -1.]]
and the output are the possible movements, 4 for each black part (32x4) or (128x1), the index where '1' is shows the part and the movement:
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0.]
My database is 1000 professional games in the American model of checkers, and I’ve turned those matches into 200k of Boards and moves
The model I’m using is a very inspired by the tensorflow guide, I just increased the number of layers and neurons and changed Loss to 'categorical_crossentropy', because 'sparse_categorical_crossentropy' does not work for my problem:
model = keras.Sequential([
keras.layers.Flatten(input_shape=(8, 4)),
keras.layers.Dense(1000, activation=tf.nn.relu),
keras.layers.Dense(1000, activation=tf.nn.relu),
keras.layers.Dense(1000, activation=tf.nn.relu),
keras.layers.Dense(1000, activation=tf.nn.relu),
keras.layers.Dense(1000, activation=tf.nn.relu),
keras.layers.Dense(128, activation=tf.nn.softmax)
])
model.compile(optimizer='adam',
loss='categorical_crossentropy',
metrics=['accuracy'])
With this model my NN achieves around 50 seasons this:
loss: 1.1787 - acc: 0.5935 - val_loss: 7.1449 - val_acc: 0.0840
And more times change almost nothing, another detail is that some times start with 0.8 acc but in the end fall to 0.6, so I really need help in what to do and why, tips on what to change in the model, etc.