2
votes

I write neural network that can play tic-tac-toe. Network has 9 input neurons, which describe the state of the board (1 - for network moves, 1.5 - for opponent moves, 0 - for empty cells) and 9 output neurons (output neuron with the highest value indicates the best action in a given state). Network has no hidden layer. Activation function - sigmoid. Learning method - Q learning + backpropagation.

The network is trained, but poorly (continues to step on the occupied cells). So i decided to add a hidden layer. And i would like to ask:

Which number of neurons in the hidden layer to use and what activation functions are better use for hidden and output layers?

1
I like you project, if you post it on Github, it'll benefit everybody. Unfortunately, it's not clear how for us to answer the question. Your question sounds like you have a bug to me (step on occupied cells), than a question for machine learning.SmallChess

1 Answers

1
votes

In general the number of neurons to be added for hidden layer is discussed here but as rule of thumb the number of neurons in the hidden layer should be approximately as the number of input neurons.

You may also consider adding number of hidden layers which discussed here

The sigmoid activation function is good and anyway you can check it and compare to other activation functions.

In your specific case you can also consider force the agent not to consider (at all) to choose occupied cells by using different architecture for the output neuron.