log(w/b) instead of w-b?

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
Gerd Isenberg
Posts: 2127
Joined: Wed Mar 08, 2006 7:47 pm
Location: Hattingen, Germany

log(w/b) instead of w-b?

Post by Gerd Isenberg » Wed May 02, 2012 8:16 pm

Inspired by Papa's entropy mobility evaluation, and recognizing that log(w/b) == -log(b/w), assuming floats, isn't the logarithm of a ratio (nominator, denominator > 0.0) in principle the "better" way, gaining more information than the plain usual difference in w/b, side2move related evaluation terms concerning material or mobility balance? Just curious.

User avatar
hgm
Posts: 23718
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: log(w/b) instead of w-b?

Post by hgm » Wed May 02, 2012 8:52 pm

log(b/w) = log(b) - log(w).

So basically this would apply a log correction to the individual total evaluations. This could be better than the usual subtraction, but there are some pitfalls. For one, individual evaluation has no natural zero point, and it does not matter whether you award a bonus to a certain advantage, or give a penalty for the opposite. But when you are applying a log correction, the zero point becomes important, as log(b+const) != log(b) + const'. E.g. normally the piece value of the King is irrelevant, because you always both have Kings. But with the log correction it becomes important. E.g. is KPK an infinite advantage (1/0) or just 25% (5/4) if we put K=4?

An advantage is that the marginal piece values get smaller when you already have more material (log(x+P) - log(x) ~ P/x). This sort of reflects the experience that to secure a win through a rather minimal advantage (like two extra Pawns, which do not provide you with enough tactical superiority to increase your lead), you have to trade down to a simple end-game before you can win. (And consequently, in drop games like Crazyhouse or Shogi, where traded material is instantly recycled, such advantages are almost meaningless, and losing after having been two pieces ahead because you were the first to make the next mistake is very common.) Many programs do increase piece values when the game phase progresses, which is qualitatively similar to a log correction.

Nevertheless this is also tricky, because Chess has a draw margin. When your advantage does not exceed the end-game draw margin, trading down actually will hasten the draw, rather than increase your advantage. This is difficult to capture in a simple formula.

Gerd Isenberg
Posts: 2127
Joined: Wed Mar 08, 2006 7:47 pm
Location: Hattingen, Germany

Re: log(w/b) instead of w-b?

Post by Gerd Isenberg » Wed May 02, 2012 9:09 pm

hgm wrote:log(b/w) = log(b) - log(w).

So basically this would apply a log correction to the individual total evaluations. This could be better than the usual subtraction, ...
Yes, it makes product w/b ratio terms negamax compatible. I wonder whether there were early programs with final w/b terms "negamaxed" by 1/x?

Daniel Shawul
Posts: 3757
Joined: Tue Mar 14, 2006 10:34 am
Location: Ethiopia
Contact:

Re: log(w/b) instead of w-b?

Post by Daniel Shawul » Fri May 11, 2012 5:37 pm

hgm wrote:log(b/w) = log(b) - log(w).

So basically this would apply a log correction to the individual total evaluations. This could be better than the usual subtraction, but there are some pitfalls. For one, individual evaluation has no natural zero point, and it does not matter whether you award a bonus to a certain advantage, or give a penalty for the opposite. But when you are applying a log correction, the zero point becomes important, as log(b+const) != log(b) + const'. E.g. normally the piece value of the King is irrelevant, because you always both have Kings. But with the log correction it becomes important. E.g. is KPK an infinite advantage (1/0) or just 25% (5/4) if we put K=4?

An advantage is that the marginal piece values get smaller when you already have more material (log(x+P) - log(x) ~ P/x). This sort of reflects the experience that to secure a win through a rather minimal advantage (like two extra Pawns, which do not provide you with enough tactical superiority to increase your lead), you have to trade down to a simple end-game before you can win. (And consequently, in drop games like Crazyhouse or Shogi, where traded material is instantly recycled, such advantages are almost meaningless, and losing after having been two pieces ahead because you were the first to make the next mistake is very common.) Many programs do increase piece values when the game phase progresses, which is qualitatively similar to a log correction.

Nevertheless this is also tricky, because Chess has a draw margin. When your advantage does not exceed the end-game draw margin, trading down actually will hasten the draw, rather than increase your advantage. This is difficult to capture in a simple formula.
I think you described the problems of approach really well. A similar problem I had was with multi-player games where the score of each player has to be kept to itself until the very last stage where it is combined in a weird way that definately will not follow the conventional approach. Depending on the degree of collaboration the score of one player could be insignificant. That is the case without using score transformation like log.

Post Reply