5
$\begingroup$

Problem

My problem is the following: Given 1000 wins, losses, and ties from a chess simulation I am using, what shape should each game be (I.e., sequence of moves leading to win/loss/tie) in order to build an deep neural network on it?

Literature Review

  1. Kind of got me in the right direction.

  2. Great theoretical way of thinking about it, but left me wanting detail.

  3. Gave a good high level tutorial, but not enough detail.

  4. Alpha beta pruning python example, but no neural network.

  5. Neural network using reinforcement learning, but I cant figure out what the (X,y) shapes are and their meaning from just digging into the source code.

Current Situation

I currently have a sample of 1000 wins, 1000 losses, and 1000 ties from the python-chess api, so if i is the index of a game, then this is the structure of the current dataset I am working with:

game_i -> (num_moves_i,8,8,16)

So each game_i where i in {1..3000} and num_moves_i is variable depending on the game (E.g., 14 for a good winning game, or 765 moves for a tie game). The 16 represents a one_hot_encoding for one of the 16 unique board pieces. The data set is also an alternating board state, so:

game_i[0] == board state of whites first move
game_i[1] == baord state of blacks first move

Furthermore, I also have alpha-beta pruning and maximin working, so for each move I have an intrinsic value associated with it using recursion three levels deep. Leading my current approach to a regression of a given move, essentially leading me to believe the AI would simply learn the heuristic and predict a value the heuristic would give.

Summary

Clearly my proof of concept 1000 winning games is not enough to make a meaningful AI, but that isn't my goal. I want to learn the techniques, not produce an enterprise scale chess AI.

  1. Does the tensor shape make sense?
  2. Is this a reinforcement learning problem? If so, how can I shape my current framing into that type of thinking? Theory in this area would be greatly appreciated as I am less familiar with it.
  3. Is this a RNN/LSTM problem? (E.g., predict the next board state).
  4. Is this a regression problem?
  5. Is this a sequence mining problem?

What is the standard approach to framing this problem, once you have data falling through the pipeline.

Your support is more than appreciated.

* UPDATE (STILL IN RESEARCH) *

With further research, a candidate label for the training data is the tensor and the item from the state-space that was selected with that board state. Then only keep games containing sequences of moves which obtain a cumulative value >= epsilon. This would require a one_hot_encoding of all moves played in all games we wish to train on, as labels. E.g., (game_i,board_ij,e2e6)

$\endgroup$
0
$\begingroup$

Not an expert here by any means. I think the simplest way to approach the chess problem is to have three components a) a game logic component, that can generate all the possible legal moves from a given board position b) an evaluation function that can score a given game position and c) your minimax/alphabeta algorithm that searches through the tree of possible moves generated by a) looking for the branch that returns the best score using b). Here, the machine learning part would be the evaluation function. You would just transform each board position in your data into a feature vector, and train some kind of classifier to return the probability of win/lose at that given board position. I think it's highly doubtful that this would work with such a small data set though.

$\endgroup$
  • $\begingroup$ This makes sense. If I am tracking your logic, you essentially only feed it winning games to get a probability of a move being a winning game from the model we build on it. Follow on: so does transforming the board in a winning game (8,8,16) into a feature vector imply building a board_to_id lookup table for each of the boards? I am also concerned with how to handle the alternating fashion of this problem, as I will be feeding a dataset with alternating moves, which seem at a glance only good for learning context not predicting quality of my move. $\endgroup$ – bmc Nov 10 '18 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.