You could have a look at the source of my Texel tuning implementation which worked marvelously. It calculates the local optimum for quiet positions.
I would also start with tuning the material scores. Maybe your rooks for instance are scored too high so it is being compensated in the psqt.
Troubles with Texel Tuning
Moderators: hgm, Rebel, chrisw
-
- Posts: 160
- Joined: Sat Jan 28, 2017 1:29 pm
- Location: The Netherlands
-
- Posts: 4185
- Joined: Tue Mar 14, 2006 11:34 am
- Location: Ethiopia
Re: Troubles with Texel Tuning
Is it really possible to get good piece values when all are initialized to 0 or a 100 ? I think you would atleast need to run it through a global optimizer, e.g. genetic algorithm (GE), to get rough values. The GEs actually accept a range such as [0, 1000] hence it doesn't really matter which initial values we use. Also they take way too many trials than needed by local methods so a few minutes might not be enough. Ofcourse the local optimizers are fast once we are in the proximity of the minima.Start simple, for instance with piece values. You don't need millions of positions here either. The goal is to verify that the method works. It should converge on ok-ish piece values starting from 0 in a few minutes. There is no point in running it overnight unless you know it works.
Another issue is the quality of the dataset; it should contain many positions with material imbalances for the purpose of tuning piece values.
Daniel
-
- Posts: 931
- Joined: Tue Mar 09, 2010 3:46 pm
- Location: New York
- Full name: Álvaro Begué (RuyDos)
Re: Troubles with Texel Tuning
Yes, tuning just material values is very easy, and gradient descent will find the right values no matter where you start. I demonstrated this in RuyTune using a fancy second-order method (L-BFGS), but any other gradient descent method would work too.Daniel Shawul wrote:Is it really possible to get good piece values when all are initialized to 0 or a 100 ? I think you would atleast need to run it through a global optimizer, e.g. genetic algorithm (GE), to get rough values. The GEs actually accept a range such as [0, 1000] hence it doesn't really matter which initial values we use. Also they take way too many trials than needed by local methods so a few minutes might not be enough. Ofcourse the local optimizers are fast once we are in the proximity of the minima.Start simple, for instance with piece values. You don't need millions of positions here either. The goal is to verify that the method works. It should converge on ok-ish piece values starting from 0 in a few minutes. There is no point in running it overnight unless you know it works.
Another issue is the quality of the dataset; it should contain many positions with material imbalances for the purpose of tuning piece values.
Daniel
-
- Posts: 1759
- Joined: Tue Apr 19, 2016 6:08 am
- Location: U.S.A
- Full name: Andrew Grant
Re: Troubles with Texel Tuning
I think I implemented SGD properly. All of my piece values make relative sense, ie knight ~= bishop, queen > rook, pawn < rest.
But I got rather low values for my pawns. ~60 when only tuning the piece values, and ~40 when tuning piece values + PSQT. Also, my knight in the midgame is worth as much as a rook (by piece value)
How likely is it that these values being low or too high, is just a result of the tuner compensating for me over valuing certain pawn features? Maybe my rook bonuses are too high in the midgame, so my rook value is lowered?
Either way, I plan on opening almost every param to the tuner tonight, and we shall see.
But I got rather low values for my pawns. ~60 when only tuning the piece values, and ~40 when tuning piece values + PSQT. Also, my knight in the midgame is worth as much as a rook (by piece value)
How likely is it that these values being low or too high, is just a result of the tuner compensating for me over valuing certain pawn features? Maybe my rook bonuses are too high in the midgame, so my rook value is lowered?
Either way, I plan on opening almost every param to the tuner tonight, and we shall see.
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
-
- Posts: 931
- Joined: Tue Mar 09, 2010 3:46 pm
- Location: New York
- Full name: Álvaro Begué (RuyDos)
Re: Troubles with Texel Tuning
Are you still using non-quiescent positions in your training data? I would recommend replacing each position with node where the quiescence search got its score. Things make a lot more sense in those conditions.AndrewGrant wrote:I think I implemented SGD properly. All of my piece values make relative sense, ie knight ~= bishop, queen > rook, pawn < rest.
But I got rather low values for my pawns. ~60 when only tuning the piece values, and ~40 when tuning piece values + PSQT. Also, my knight in the midgame is worth as much as a rook (by piece value)
-
- Posts: 1759
- Joined: Tue Apr 19, 2016 6:08 am
- Location: U.S.A
- Full name: Andrew Grant
Re: Troubles with Texel Tuning
I am using 725K quiet positions that was posted by another user.
Found here : http://www.talkchess.com/forum/viewtopic.php?t=61427
Found here : http://www.talkchess.com/forum/viewtopic.php?t=61427
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
-
- Posts: 931
- Joined: Tue Mar 09, 2010 3:46 pm
- Location: New York
- Full name: Álvaro Begué (RuyDos)
Re: Troubles with Texel Tuning
I can offer you the positions I use. The format is fairly obvious: https://bitbucket.org/alonamaloh/ruy_tu ... th_resultsAndrewGrant wrote:I am using 725K quiet positions that was posted by another user.
Found here : http://www.talkchess.com/forum/viewtopic.php?t=61427
The positions are generated by going through a collection of computer-computer games downloaded from CCRL, having RuyDos search starting from those positions, and collecting the position of the 1000th call to the evaluation function. I then ran very quick Stockfish-vs-Stockfish games starting from those positions to assign labels to them. Finally I modified the positions using quiescence search the way I described earlier. I think this procedure should get rid of many of the biases that other collection methods may have. In particular, I think you'll find many more uneven-material positions here.
-
- Posts: 1759
- Joined: Tue Apr 19, 2016 6:08 am
- Location: U.S.A
- Full name: Andrew Grant
Re: Troubles with Texel Tuning
I will run using your positions when I get back to my desktop. Thanks!
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
-
- Posts: 4185
- Joined: Tue Mar 14, 2006 11:34 am
- Location: Ethiopia
Re: Troubles with Texel Tuning
I still think the initial values are so important for any local method. Even for a toy problem like optimizing the rosenbrok functions, gradient methods fail if i pick the wrong initial values. See below.AlvaroBegue wrote: Yes, tuning just material values is very easy, and gradient descent will find the right values no matter where you start. I demonstrated this in RuyTune using a fancy second-order method (L-BFGS), but any other gradient descent method would work too.
Code: Select all
def rosen(x):
"""The Rosenbrock function"""
print x
return sum(100.0*(x[1:]-x[:-1]**2.0)**2.0 + (1-x[:-1])**2.0)
x0 = np.array([13, 0.7, 0.8, 1.9, 1.2])
res = minimize(rosen, x0, method='BFGS', options={'xtol': 1e-8, 'disp': True})
Do you have the source code and database you used to tune piece values for demonstration purposes?
Daniel
-
- Posts: 931
- Joined: Tue Mar 09, 2010 3:46 pm
- Location: New York
- Full name: Álvaro Begué (RuyDos)
Re: Troubles with Texel Tuning
Yes. Just download the repository here: https://bitbucket.org/alonamaloh/ruy_tuneDaniel Shawul wrote:I still think the initial values are so important for any local method. Even for a toy problem like optimizing the rosenbrok functions, gradient methods fail if i pick the wrong initial values. See below.AlvaroBegue wrote: Yes, tuning just material values is very easy, and gradient descent will find the right values no matter where you start. I demonstrated this in RuyTune using a fancy second-order method (L-BFGS), but any other gradient descent method would work too.
Setting x0[0]=1 gives 1.0 for all pameters.Code: Select all
def rosen(x): """The Rosenbrock function""" print x return sum(100.0*(x[1:]-x[:-1]**2.0)**2.0 + (1-x[:-1])**2.0) x0 = np.array([13, 0.7, 0.8, 1.9, 1.2]) res = minimize(rosen, x0, method='BFGS', options={'xtol': 1e-8, 'disp': True})
Do you have the source code and database you used to tune piece values for demonstration purposes?
Daniel
The file sample/tune.cpp contains an example that finds the material values. The file sample/evaluation_parameters has the initial guesses, which are all 0.