Determining values for piece-square tables.

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

gingell

Re: Determining values for piece-square tables.

Post by gingell »

I've experimented with the the idea of using Bayes Law to estimate the weights for different evaluation features, like piece/location pairs. The approach is similar to spam filtering: if you can train a filter to measure "spaminess", then maybe it can be used to measure the "goodness" of a chess position.

I had pretty mixed results but my model was very simple. I think there's more potential here.

Here's what I wrote up at the time:

https://sourceforge.net/apps/wordpress/ ... eneration/

https://sourceforge.net/apps/wordpress/ ... are-tables
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Determining values for piece-square tables.

Post by Don »

Gian-Carlo Pascutto wrote:
Don wrote: There are many issues to grapple with - how do you convert an ELO rating for a move to values for a pieces square table?
I consider each game a series of matches (=the positions) between two teams of players, with a known result. The teams of players are the evaluation features.

With the Bradley-Terry model, you can calculate the ratings for each individual player, i.e. you directly get the evaluation weights for each feature.

It's a direct application of Remi Couloms result for go to chess. The method is insanely powerful.
Ok, lets's say you have a match (the position) and the competition is between all the legal moves, right? So if you view an individual as the state change between the from and to squares, how do you assign credit for this? Do you view vacating one square and occupying another as a "team of 2" players?

- Don
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Determining values for piece-square tables.

Post by Don »

Don wrote:
Gian-Carlo Pascutto wrote:
Don wrote: There are many issues to grapple with - how do you convert an ELO rating for a move to values for a pieces square table?
I consider each game a series of matches (=the positions) between two teams of players, with a known result. The teams of players are the evaluation features.

With the Bradley-Terry model, you can calculate the ratings for each individual player, i.e. you directly get the evaluation weights for each feature.

It's a direct application of Remi Couloms result for go to chess. The method is insanely powerful.
Ok, lets's say you have a match (the position) and the competition is between all the legal moves, right? So if you view an individual as the state change between the from and to squares, how do you assign credit for this? Do you view vacating one square and occupying another as a "team of 2" players?

- Don
Ok, I think I can answer my own question after carefully re-reading you post. Sorry!
mjlef
Posts: 1494
Joined: Thu Mar 30, 2006 2:08 pm

Re: Determining values for piece-square tables.

Post by mjlef »

gingell wrote:I've experimented with the the idea of using Bayes Law to estimate the weights for different evaluation features, like piece/location pairs. The approach is similar to spam filtering: if you can train a filter to measure "spaminess", then maybe it can be used to measure the "goodness" of a chess position.

I had pretty mixed results but my model was very simple. I think there's more potential here.

Here's what I wrote up at the time:

https://sourceforge.net/apps/wordpress/ ... eneration/

https://sourceforge.net/apps/wordpress/ ... are-tables
Could the same technique be used to improve overall move ordering? I have never really been happy with history tables.
gingell

Re: Determining values for piece-square tables.

Post by gingell »

Could the same technique be used to improve overall move ordering? I have never really been happy with history tables.
I don't think so. I don't think you can substitute static tables built from a collection of games for the dynamic data you collect in history tables.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Determining values for piece-square tables.

Post by bob »

Gian-Carlo Pascutto wrote:
Don wrote: There are many issues to grapple with - how do you convert an ELO rating for a move to values for a pieces square table?
I consider each game a series of matches (=the positions) between two teams of players, with a known result. The teams of players are the evaluation features.

With the Bradley-Terry model, you can calculate the ratings for each individual player, i.e. you directly get the evaluation weights for each feature.

It's a direct application of Remi Couloms result for go to chess. The method is insanely powerful.
Just for the record, Cozzie and I used simulated annealing to tune the pc/sq values in Crafty (among others). The values came out significantly different, yet when I then fed them in to the cluster, they were typically worse. The annealing used very fast games to do the tuning, and that didn't carry over to more normal games, although the games I play on the cluster are generally pretty fast to get quick results back.

In fact, no numbers produced by this approach actually improved play, and most hurt. Seemed like a potential breakthrough idea, but at least for Crafty, the hand-tuned values could not be improved on via this approach.
CRoberson
Posts: 2055
Joined: Mon Mar 13, 2006 2:31 am
Location: North Carolina, USA

Re: Determining values for piece-square tables.

Post by CRoberson »

Mike,

All this discussion is great, but I'll give you something very simple that will get you started and meet your initial goal quickly.

Code: Select all

   1) Get a big pgn of your favorite GM or favorite computer program.
   2) Install scid
   3) click on the pgn
   4) Now, bring up the player finder tool and sort by games (click on games)
   5) Click on the player you want to emulate.
   6) In the pop up player information table, click on the number of games for white.
   7) Click on Windows->game list and you should see a game list for your chosen player with white pieces.
   8) Click on tools -> piece tracker.
   9) Go through each white piece and observe the typical squares.
  10) Do one of two things:
        a) Create a symmetrial table for black
        b) Run through the above process for black
This is not the best way to do it, but it is fast and meets your inital goals.
User avatar
xsadar
Posts: 147
Joined: Wed Jun 06, 2007 10:01 am
Location: United States
Full name: Mike Leany

Re: Determining values for piece-square tables.

Post by xsadar »

CRoberson wrote:Mike,

All this discussion is great, but I'll give you something very simple that will get you started and meet your initial goal quickly.

Code: Select all

   1) Get a big pgn of your favorite GM or favorite computer program.
   2) Install scid
   3) click on the pgn
   4) Now, bring up the player finder tool and sort by games (click on games)
   5) Click on the player you want to emulate.
   6) In the pop up player information table, click on the number of games for white.
   7) Click on Windows->game list and you should see a game list for your chosen player with white pieces.
   8) Click on tools -> piece tracker.
   9) Go through each white piece and observe the typical squares.
  10) Do one of two things:
        a) Create a symmetrial table for black
        b) Run through the above process for black
This is not the best way to do it, but it is fast and meets your inital goals.
Thanks. Looks like a quick simple way to get started. I'll look into it.
User avatar
xsadar
Posts: 147
Joined: Wed Jun 06, 2007 10:01 am
Location: United States
Full name: Mike Leany

Re: Determining values for piece-square tables.

Post by xsadar »

bob wrote:
xsadar wrote:For a long time I've had piece-square tables in my engine that I had "temporarily" borrowed from other engines. This has prevented me from releasing my engine, because I want to release an engine that's entirely my own work (and definitely avoid releasing an engine that infringes on other people's copyrights).
I've begun a complete rewrite from the ground up, and have no intention of borrowing tables again, so my question is: how do people come up with these values in the first place?

I'm pretty mediocre at chess myself, and have very little book knowledge about chess, so any guesstimates I make will most likely be way off, and I would imagine that even a Grand Master's estimates would be off by a fair amount. So are there any suggestions on how I can go about determining those values? Or information I might be able to use in the process? Testing my values will be quite a task since I don't have a cluster like Bob's -- I'll just have to run tests while I'm at work or sleeping -- so, obviously, the closer I can get my initial estimates, the better.
I just make reasonable assumptions, and then test them by playing games and looking at what happens. If a knight ends up on the edge of the board, out of play, and that costs you a game, you probably don't have the values tuned very well yet...
Now that I've got my plain alpha-beta search (plus qsearch) up and going for my rewrite and after watching it play some games (and playing some against it myself), I'm starting to think just making reasonable assumptions (maybe even some not-so-reasonable assumptions) may give more improvement over material-only than I originally thought. I had assumed that the search alone would give it at least somewhat decent looking play, but it's just flinging its pieces around all over the place (as long as their not in immediate danger of being captured). But after seeing it do that, and thinking on it, I'm not sure why I expected it to do much else. On my last engine, I put borrowed piece-square tables in right from the get-go, so with it I never saw that problem.
I haven't fully tested my search yet though (except the qsearch, which I wrote before the main search), so it's entirely possible that a broken search is part of the problem.
User avatar
rvida
Posts: 481
Joined: Thu Apr 16, 2009 12:00 pm
Location: Slovakia, EU

Re: Determining values for piece-square tables.

Post by rvida »

I think the simplified material + PST eval from http://chessprogramming.wikispaces.com/ ... n+function by Tomasz Michniewski is a very good starting point.

Edit: PS: especially for testing new ideas in search algorithms