Online Marketing

Learning Chess from data

My name is Tom Ron and I will present the Rosati who couldn’t attend. You can see both our slides, github nib m-learning chess. So what are you going to talk about today? Is learning chess from data, but what everyone wants to make computer we’re a bit modest and we just want to make the computer play chess, okay, um! So, what’s on our mind, we want to know if a computer can learn chess only by looking at data of chess games.

So there are many questions that can be asked in this domain. We’re going to focus today on two of those questions. One is giving a board state: can we make okay, we do a specific move. Is it a legal move and that one is game over giving a board state? Is it a checkmate? Is the game? Has the game ended? Of course, if those are possible, then the sky is the limit, and what else can we imply learn about other systems, maybe some physics and other things? I want to mention this that this is a work on progress, we’re still working on it.

We have additional and further ideas, but I came here today to show you what we have done so far. Ok, so, let’s start and what will know about chess – and there is first done at this – there is some constant tension between feature that we allow ourselves to know when doing this learning process and features or other things that we wanted to know. But first we know that there are two sides to parties who play the game.

We know that could and with either one winner or a time, no two winners or other situation. We know that the board is eight by eight and doesn’t change through the game. We know that there are different pieces that have different unknown properties such as: how can our the species move? Can they eat other pieces? What happened to them when they get eaten, maybe promotion, four pounds and so on? Okay, okay, so the data set we worked on is given in algebraic chess notation.

If you have some time in the end, I’ll show you how it looks like, but the idea is that every square on the board is represented by a letter, A two to H and the number one to write and the move is basically done from one square To another, usually only the two square is written, and while there is only one piece that can do the truth or if it’s not clear than the both the two and the from square is written, we ignored the metadata on this set, such as Flair, ranking, location And so on, we had just a bit more than one thousand one hundred thousand games with full or partial description.

There were many games that didn’t end. I do it checkmate or tie just ended in the middle and had a bit more than eight million most with distributes tribution between the different pieces. We use a pie tomorrow package, which is called chest. It allows us to parse chess McGavock notation and provided the board status provided methods like is this as chances making so on, and some pilot mainly site by some mud float for plotting and the 9pi.

Basically, we thought we would head. We would have not enough or big enough data for doing MapReduce and all we build it as your first we’re going to to do MapReduce, but for this time it was enough to do it on a single machine, maybe some in the future. So this nurse think we wanted to do the first question we addressed before the game on. Can we do a simple move, so the most naive think would be okay.

Have we seen that smooth before? By saying this move, I mean the board status and the move? I want to do if so, yes, good, do it no try again, maybe there’s not enough data, so I haven’t seen it move or maybe it’s not legal and therefore I haven’t seen it. It’s not efficient on neither running time or memory so well and, of course, there’s no learning down here. So, let’s move to our second try you and so for each move for each move.

We made. We checked the difference from the to describe farm square and to square, and we drove the diff histogram. For example, if the pound move two steps on the first time a pumpkin move, then the X difference is zero and the y lift is two and we did some adjustments of the black and white. So it will be relative it, and now you can see those histogram. So this is a least 1/4 pound a pound can move either one step forward, two step forth or one step forward into the side and two to each side.

This is how the Bishop move. This is how the workman only stretch. This is how an I night room it’s a kind of nice, the king, and you can see that the king can move one step to each side and cast a link to one of the sides. Okay, so the price of these approaches, it’s very good for common moves, and it’s getting better as this data size files, of course, and it’s fairly time and memory efficient, we can code all this really really simply and, however, it doesn’t take into account the word status.

So if there are pieces in the way, I cannot answer this question. I can answer it strongly, so so it’s a necessary condition if we have enough data, but it’s not sufficient so did next. Take we did on this idea. Was that for each move we have not only looked at the move, dick, but also into the surrounding of each piece. So you can see here and we have three possible states. One is occupied, one is 3 and Y is out of the board.

If we’re standing off the edge of the board, then some of the squares ma can be out of the board, and this is some of the results. We got aggregating those histograms and doing some working on it. So, for example, for the Quinn, if the Quinn wanted to move to at least 2 steps, then the square above it and on the right must be free, and that makes sense knowing the chess rules. Another thing about the Quinn: if you want to move seven steps downward and right, then this dis means that she’s moving cross of the board.

Therefore she must stand in the court in the corner and this square must be free. Okay, cool um. So is the the King: if there is custom link and the King move, then the one near it should be free must be free also for the pound. If the pound go goes forward, and, oh surprisingly, nothing for the night and no chess rules, we know that the the knight can jump over pieces. However, not having this rule doesn’t tell us anything, because maybe there is not enough data.

Maybe there is nothing relevant, but that’s nice for us, knowing the rules of the system that the knight can skip over pieces. Okay. So the premise of this approach is also. We keep it efficient, not too much. Doesn’t that win it and we store and of course run time we take the surrounding into account, so we can argue whether the surrounding is one reduce to reduce more, but also doing this says tell us that we have the trade-off.

I talked before that we have some external knowledge about the game and about the environment. We are in so again this trade-off and the main comp about this or these strategies is that to assume that moves are independent of one another and while it we can usually say that true, it’s not true for all. The moves, for example, cast a link and a kink and not to castling if there was just before or if the King moved before, and there are several more more moves that are limited by this limitation.

So, okay, this is how we’re going to discuss about moves today and we still have an idea to improve it. But but we know that this gives you roughly good results, and it’s of course, let’s generalize, which I mentioned before. Okay, so now for learning checkmate – and here we ask giving state of a board, is it checkmate or not, we’re not asking whether if it is a checkmate who, on the black or the white, we might be asking that in the future? Okay, yeah, we used several datasets 10k a 30k, a 800 K, the training set.

We use 40 % of its, we used for training 60 for testing, and we had 50/50 of true and full samples. Of course, the real distribution. The probability is much less because you only have one checkmate at most at each game, maybe less and we use SVM classifier with linear kernel. We won’t probably won’t use it in the future, although we had some nice results. Just with this naive, classifier now crash course about classification for people who don’t come from this domain, really crash course um.

I know I speak too fast and I apologize. We have a lot to talk about tonight. Ok, so we start with data and then we extract features and we’ll talk about the features we we use in a minute, but features can be current. Reachable and features categories met, many others may be. A combination may be. The features depend on one another. There are models for each problem and then there is a classification.

Some of the data is used for training some for testing some. You predict we use side pipe for this mission and actually we’re able cipher is very, very general, and we were able to use very a code that we used before for a total of different tests, just applying our feature extraction and pushing it to the classifier. We had and actually another good feature of cyber. It is very easy to tackle between different classifiers.

They all have trying and estimate and fit functions so just play with it. Okay, so here again we have a few versions. So the first version we had was a simple count, features what what that means. First, we counted the number the total number of faces that were on the board. Then we counted how many white pieces, how many black pieces for each type of piece we counted. How many piston world, for example, door, five white count and three black pants, so we had total of eight pounds.

We also counted the number of different white points, five and three black pounds. So this process to something that well, is a bit better than a monkey with accuracy of 70 we had for the cases forward checkmate. This is a checkmate and we were four not checkmate were able to say in 59 percent of time that it’s not a checkmate, but then we had some misclassifications so well. We want to be much better than a monkey, so we moved to the next thing and the next thing was using the previous features and you think that about the first-degree neighbors in this case we didn’t looked out of the board and we excluded it.

But we’ll do that on the next versions, and so we looked on that of empty. Is it of the same side of the piece we are looking on or from other piece around it and we aggregated the data for all the different pieces on the board from each party, and we also built some boolean features based on this data, for example, is Is there more pieces around me from my side or from the other side? Is it mostly empty and such features, and we did had improvement? We can say see that the checkmate rises to now able to classify well on 87 %.

Remember we had 59 % previously, so we’re doing much better now, and this third version was doing taking the same as before, but extending the radius to two and three. This make much more features, however. 300 features is not that much and maybe in the next versions. We can add more features without it’s not as much and but it’s I said four, it makes it less journal. I generalize, as we assume something bigger about the game and the board, and indeed we we had improvement.

Curacy is eighty nine point. Five and both has its improved. We can ask further questions if increasing the radius to four five six eight would improve it. I personally don’t like this approach and don’t want to do it because we assume more about the board and about the game and about the system as a whole, and I would rather think about or suggest different features so having this benchmark. What what we think about or what we suggest want to do in the future? Okay, so test different classifiers, you used SP and maybe changing the kernel, maybe think of nearest neighbor, may be using some deep learning as a password.

I don’t know this is a small change, but I think that it would have interesting effect and the result integrate out of the board. The edges of the board into the different counts, we’re doing. Okay asking who is the winner, which I mentioned earlier? Is it the black the white? We can either approach it as multi classification problem, where the white one, whether the black one or it’s not a checkmate or we can use it just as black or white like if we have checkmate.

Is it black or white who won okay, asking whether a specific situation is just not necessary, checkmate, complex, smooth detection, okay, history, starting writing the history, or maybe we can think of other features you have to represent us what we have done, maybe, for example, counting how Many time this specific piece moved or something else, of course, as I said in summation, we want to reduce the data.

We have external data, we have on the game: okay, more efficient parsing. We use the chess package which it, which is nice, but on some cases we did something like bootstrapping. We took the data we put it into. The chest will produce what we wanted. Maybe we cannot not do this lap and just do it ourself scaling. So for classifying the 800,000 samples, it was really hard for our computers and sci-fi.

It eventually happened, but it was hard. So maybe we need to think about distributing it about using something likes like shaman that was mentioned here earlier. I think there are many tools that we can think of and surprising. We have time for question and thank you for listening so far, but and of course the question is whether we can like to honor system. Can you learn physics just by looking at me? For example, Chesson Giants generally are stateless.

We just get a position and make estimations neither except for the first part of the game, which is very easy, any stage just the Inquisition and not that yeah, but knowing what they can do doing strategy we’re focused on you. You


By Jimmy Dagger

Find out my interests on my awesome blog!

One reply on “Learning Chess from data”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.