I want to train a neural network to play a 2048 game. I know that NN is not a good choice for state games such as 2048, but I want to ensure that NN will play the game as an experienced person, i.e. Moving tiles in only three directions.
But I canβt understand how to train NN on my own, since we donβt know the actual conclusion. Usually, for example, in a regression, you know the correct result, and you can calculate the loss (for example, the standard error) and update the weight. But in 2048 the actual conclusion is basically unknown (of course, you can calculate the score for each direction that you can move, for example, the direction with the highest difference score_after_move - previous_score will be our real result, but I think that is not the way to self-determination, to find out NN). So can you determine the loss function for a 2048 game? The best will be differentiable.
The next question is when to update weights: after each move or, rather, after a full game (game)?
If this is important: my NN topology will now be simple:
2D matrix of gaming board -> 2D matrix of input neurons -> 2D fully-connected hidden layer -> 1D 4-neuron layer
So, each tile will be inserted into the corresponding neuron in the first layer (is there any special name for the 2D fully connected layer?). The expected exit from the last layer is a vector of length 4, for example. [1, 0, 0, 0] will be the "up" direction of travel.
Currently, I have implemented a headless class (in Python / NumPy) for a 2048 game, because using visual input is slow, as well as more work.
PS Maybe I'm wrong about learning NN for this game (or games in general). Feel free to show me the best way, I would appreciate it. Thanks:)
EDIT: Strengthening learning seems like this. Here are some useful links:
Demystification of deep reinforcement learning
Methods of action and n-armed gangster issues
Q-learning for Keras
Deep Reinforcement Training for Keras