pawn hash and eval tuning
Moderators: hgm, Rebel, chrisw
-
- Posts: 778
- Joined: Sat Jul 01, 2006 7:11 am
pawn hash and eval tuning
How do people handle pawn hash when tuning? It just occurred to me if I have a pawn hash, then 99% of the time I won't have pawn terms to tune.
-
- Posts: 879
- Joined: Mon Dec 15, 2008 11:45 am
Re: pawn hash and eval tuning
Hi,
you can simply always compute the data when in tuning mode, like...
At least if the tuning algorithm is not sensitive to speed of the engine and you are talking of parameter tuning.
you can simply always compute the data when in tuning mode, like...
Code: Select all
pawn_t* PawnTable::getSlot(Position* pos)
{
pawn_t* slot = &table[getKey(pos) & _HASHMASK];
if( NOT_TUNING )
if(BitUtil::hi32(getKey(pos)) == slot->lock) {
return slot;
}
evaluate(pos,slot);
return slot;
}
-
- Posts: 686
- Joined: Thu Mar 03, 2011 4:57 pm
- Location: Germany
Re: pawn hash and eval tuning
This is not a feature of having a pawn hash or not. The pawn hash only saves some computation. If you remove the pawn hash and compute everything from scratch you have the same outcome from tuning (only a bit slower).
-
- Posts: 879
- Joined: Mon Dec 15, 2008 11:45 am
Re: pawn hash and eval tuning
I can't follow now. If parameters are changed for pawn evaluation you need to re-calculate the score of course.tpetzke wrote:This is not a feature of having a pawn hash or not. The pawn hash only saves some computation. If you remove the pawn hash and compute everything from scratch you have the same outcome from tuning (only a bit slower).
For example if you have set 100 cp for a passed pawn but change the value to 105 cp you need to compute the outcome again. Otherwise you would retrieve the score which was computed with 100 cp.
-
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: pawn hash and eval tuning
Not quite. 99% of the time you won't have to COMPUTE the pawn scores, but you use them at every terminal node... So the tuning is the same whether you hash or not.jwes wrote:How do people handle pawn hash when tuning? It just occurred to me if I have a pawn hash, then 99% of the time I won't have pawn terms to tune.
-
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: pawn hash and eval tuning
Pawn hash doesn't survive program termination. You play a game, or test a position, then it would be cleared, at least when using games for testing. If you are talking about some sort of automated annealing or whatever, then you would likely want to disable it.Desperado wrote:I can't follow now. If parameters are changed for pawn evaluation you need to re-calculate the score of course.tpetzke wrote:This is not a feature of having a pawn hash or not. The pawn hash only saves some computation. If you remove the pawn hash and compute everything from scratch you have the same outcome from tuning (only a bit slower).
For example if you have set 100 cp for a passed pawn but change the value to 105 cp you need to compute the outcome again. Otherwise you would retrieve the score which was computed with 100 cp.
-
- Posts: 4367
- Joined: Fri Mar 10, 2006 5:23 am
- Location: http://www.arasanchess.org
Re: pawn hash and eval tuning
For this reason I disable caching when tuning.
See https://github.com/jdart1/arasan-chess/ ... /scoring.h.
The evaluation function takes a boolean parameter:
See https://github.com/jdart1/arasan-chess/ ... /scoring.h.
The evaluation function takes a boolean parameter:
Code: Select all
// evaluate "board" from the perspective of the side to move.
int evalu8( const Board &board, bool useCache = true );
-
- Posts: 879
- Joined: Mon Dec 15, 2008 11:45 am
Re: pawn hash and eval tuning
Well, the tuning method needs to be specified for the original post.bob wrote:Pawn hash doesn't survive program termination. You play a game, or test a position, then it would be cleared, at least when using games for testing. If you are talking about some sort of automated annealing or whatever, then you would likely want to disable it.Desperado wrote:I can't follow now. If parameters are changed for pawn evaluation you need to re-calculate the score of course.tpetzke wrote:This is not a feature of having a pawn hash or not. The pawn hash only saves some computation. If you remove the pawn hash and compute everything from scratch you have the same outcome from tuning (only a bit slower).
For example if you have set 100 cp for a passed pawn but change the value to 105 cp you need to compute the outcome again. Otherwise you would retrieve the score which was computed with 100 cp.
-
- Posts: 2559
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: pawn hash and eval tuning
Well, you run n threads on million(s) of positions for tuning, one run of course has the same parameters. Naturally you flush the caches between runs, I don't see any problem here.Desperado wrote:I can't follow now. If parameters are changed for pawn evaluation you need to re-calculate the score of course.
Eval cache speeds up Texel tuning a lot, at least in my case it did.
-
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: pawn hash and eval tuning
This is cache 101. If something invalidates the data, it can't be used again. If you allow the score weights to change, you have to take action. I would think that's pretty obvious...Desperado wrote:Well, the tuning method needs to be specified for the original post.bob wrote:Pawn hash doesn't survive program termination. You play a game, or test a position, then it would be cleared, at least when using games for testing. If you are talking about some sort of automated annealing or whatever, then you would likely want to disable it.Desperado wrote:I can't follow now. If parameters are changed for pawn evaluation you need to re-calculate the score of course.tpetzke wrote:This is not a feature of having a pawn hash or not. The pawn hash only saves some computation. If you remove the pawn hash and compute everything from scratch you have the same outcome from tuning (only a bit slower).
For example if you have set 100 cp for a passed pawn but change the value to 105 cp you need to compute the outcome again. Otherwise you would retrieve the score which was computed with 100 cp.
Same problem with position learning. If ANYTHING changes, old position learning should be invalidated.